* vm_map_entry_charge_object * * If there is no object backing this entry, create one. Otherwise, if * the entry has cred, give it to the backing object. */
| 2395 | * the entry has cred, give it to the backing object. |
| 2396 | */ |
| 2397 | static inline void |
| 2398 | vm_map_entry_charge_object(vm_map_t map, vm_map_entry_t entry) |
| 2399 | { |
| 2400 | |
| 2401 | VM_MAP_ASSERT_LOCKED(map); |
| 2402 | KASSERT((entry->eflags & MAP_ENTRY_IS_SUB_MAP) == 0, |
| 2403 | ("map entry %p is a submap", entry)); |
| 2404 | if (entry->object.vm_object == NULL && !map->system_map && |
| 2405 | (entry->eflags & MAP_ENTRY_GUARD) == 0) |
| 2406 | vm_map_entry_back(entry); |
| 2407 | else if (entry->object.vm_object != NULL && |
| 2408 | ((entry->eflags & MAP_ENTRY_NEEDS_COPY) == 0) && |
| 2409 | entry->cred != NULL) { |
| 2410 | VM_OBJECT_WLOCK(entry->object.vm_object); |
| 2411 | KASSERT(entry->object.vm_object->cred == NULL, |
| 2412 | ("OVERCOMMIT: %s: both cred e %p", __func__, entry)); |
| 2413 | entry->object.vm_object->cred = entry->cred; |
| 2414 | entry->object.vm_object->charge = entry->end - entry->start; |
| 2415 | VM_OBJECT_WUNLOCK(entry->object.vm_object); |
| 2416 | entry->cred = NULL; |
| 2417 | } |
| 2418 | } |
| 2419 | |
| 2420 | /* |
| 2421 | * vm_map_entry_clone |
no test coverage detected