Changeset View
Changeset View
Standalone View
Standalone View
sys/vm/vm_object.c
Show First 20 Lines • Show All 738 Lines • ▼ Show 20 Lines | vm_object_backing_remove_locked(vm_object_t object) | ||||
VM_OBJECT_ASSERT_WLOCKED(backing_object); | VM_OBJECT_ASSERT_WLOCKED(backing_object); | ||||
KASSERT((object->flags & OBJ_COLLAPSING) == 0, | KASSERT((object->flags & OBJ_COLLAPSING) == 0, | ||||
("vm_object_backing_remove: Removing collapsing object.")); | ("vm_object_backing_remove: Removing collapsing object.")); | ||||
vm_object_sub_shadow(backing_object); | vm_object_sub_shadow(backing_object); | ||||
if ((object->flags & OBJ_SHADOWLIST) != 0) { | if ((object->flags & OBJ_SHADOWLIST) != 0) { | ||||
LIST_REMOVE(object, shadow_list); | LIST_REMOVE(object, shadow_list); | ||||
object->flags &= ~OBJ_SHADOWLIST; | vm_object_clear_flag(object, OBJ_SHADOWLIST); | ||||
} | } | ||||
object->backing_object = NULL; | object->backing_object = NULL; | ||||
} | } | ||||
static void | static void | ||||
vm_object_backing_remove(vm_object_t object) | vm_object_backing_remove(vm_object_t object) | ||||
{ | { | ||||
vm_object_t backing_object; | vm_object_t backing_object; | ||||
Show All 17 Lines | vm_object_backing_insert_locked(vm_object_t object, vm_object_t backing_object) | ||||
VM_OBJECT_ASSERT_WLOCKED(object); | VM_OBJECT_ASSERT_WLOCKED(object); | ||||
atomic_add_int(&backing_object->shadow_count, 1); | atomic_add_int(&backing_object->shadow_count, 1); | ||||
if ((backing_object->flags & OBJ_ANON) != 0) { | if ((backing_object->flags & OBJ_ANON) != 0) { | ||||
VM_OBJECT_ASSERT_WLOCKED(backing_object); | VM_OBJECT_ASSERT_WLOCKED(backing_object); | ||||
LIST_INSERT_HEAD(&backing_object->shadow_head, object, | LIST_INSERT_HEAD(&backing_object->shadow_head, object, | ||||
shadow_list); | shadow_list); | ||||
object->flags |= OBJ_SHADOWLIST; | vm_object_set_flag(object, OBJ_SHADOWLIST); | ||||
} | } | ||||
object->backing_object = backing_object; | object->backing_object = backing_object; | ||||
} | } | ||||
static void | static void | ||||
vm_object_backing_insert(vm_object_t object, vm_object_t backing_object) | vm_object_backing_insert(vm_object_t object, vm_object_t backing_object) | ||||
{ | { | ||||
▲ Show 20 Lines • Show All 703 Lines • ▼ Show 20 Lines | if (shared || source != NULL) { | ||||
* Try to optimize the result object's page color when | * Try to optimize the result object's page color when | ||||
* shadowing in order to maintain page coloring | * shadowing in order to maintain page coloring | ||||
* consistency in the combined shadowed object. | * consistency in the combined shadowed object. | ||||
*/ | */ | ||||
if (source != NULL) { | if (source != NULL) { | ||||
vm_object_backing_insert(result, source); | vm_object_backing_insert(result, source); | ||||
result->domain = source->domain; | result->domain = source->domain; | ||||
#if VM_NRESERVLEVEL > 0 | #if VM_NRESERVLEVEL > 0 | ||||
result->flags |= source->flags & OBJ_COLORED; | vm_object_set_flag(result, | ||||
(source->flags & OBJ_COLORED)); | |||||
result->pg_color = (source->pg_color + | result->pg_color = (source->pg_color + | ||||
OFF_TO_IDX(*offset)) & ((1 << (VM_NFREEORDER - | OFF_TO_IDX(*offset)) & ((1 << (VM_NFREEORDER - | ||||
1)) - 1); | 1)) - 1); | ||||
#endif | #endif | ||||
} | } | ||||
VM_OBJECT_WUNLOCK(result); | VM_OBJECT_WUNLOCK(result); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 1,391 Lines • Show Last 20 Lines |