Changeset View
Changeset View
Standalone View
Standalone View
sys/vm/vm_object.c
Show First 20 Lines • Show All 186 Lines • ▼ Show 20 Lines | KASSERT(TAILQ_EMPTY(&object->memq), | ||||
("object %p has resident pages in its memq", object)); | ("object %p has resident pages in its memq", object)); | ||||
KASSERT(vm_radix_is_empty(&object->rtree), | KASSERT(vm_radix_is_empty(&object->rtree), | ||||
("object %p has resident pages in its trie", object)); | ("object %p has resident pages in its trie", object)); | ||||
#if VM_NRESERVLEVEL > 0 | #if VM_NRESERVLEVEL > 0 | ||||
KASSERT(LIST_EMPTY(&object->rvq), | KASSERT(LIST_EMPTY(&object->rvq), | ||||
("object %p has reservations", | ("object %p has reservations", | ||||
object)); | object)); | ||||
#endif | #endif | ||||
#if 0 | |||||
KASSERT(blockcount_read(&object->paging_in_progress) == 0, | KASSERT(blockcount_read(&object->paging_in_progress) == 0, | ||||
("object %p paging_in_progress = %d", | ("object %p paging_in_progress = %d", | ||||
object, blockcount_read(&object->paging_in_progress))); | object, blockcount_read(&object->paging_in_progress))); | ||||
#endif | |||||
KASSERT(!vm_object_busied(object), | KASSERT(!vm_object_busied(object), | ||||
("object %p busy = %d", object, blockcount_read(&object->busy))); | ("object %p busy = %d", object, blockcount_read(&object->busy))); | ||||
KASSERT(object->resident_page_count == 0, | KASSERT(object->resident_page_count == 0, | ||||
("object %p resident_page_count = %d", | ("object %p resident_page_count = %d", | ||||
object, object->resident_page_count)); | object, object->resident_page_count)); | ||||
KASSERT(object->shadow_count == 0, | KASSERT(object->shadow_count == 0, | ||||
("object %p shadow_count = %d", | ("object %p shadow_count = %d", | ||||
object, object->shadow_count)); | object, object->shadow_count)); | ||||
▲ Show 20 Lines • Show All 83 Lines • ▼ Show 20 Lines | #if VM_NRESERVLEVEL > 0 | ||||
kernel_object->flags |= OBJ_COLORED; | kernel_object->flags |= OBJ_COLORED; | ||||
kernel_object->pg_color = (u_short)atop(VM_MIN_KERNEL_ADDRESS); | kernel_object->pg_color = (u_short)atop(VM_MIN_KERNEL_ADDRESS); | ||||
#endif | #endif | ||||
/* | /* | ||||
* The lock portion of struct vm_object must be type stable due | * The lock portion of struct vm_object must be type stable due | ||||
* to vm_pageout_fallback_object_lock locking a vm object | * to vm_pageout_fallback_object_lock locking a vm object | ||||
* without holding any references to it. | * without holding any references to it. | ||||
* | |||||
* paging_in_progress is valid always. Lockless references to | |||||
* the objects may acquire pip and then check OBJ_DEAD. | |||||
*/ | */ | ||||
obj_zone = uma_zcreate("VM OBJECT", sizeof (struct vm_object), NULL, | obj_zone = uma_zcreate("VM OBJECT", sizeof (struct vm_object), NULL, | ||||
#ifdef INVARIANTS | #ifdef INVARIANTS | ||||
vm_object_zdtor, | vm_object_zdtor, | ||||
#else | #else | ||||
NULL, | NULL, | ||||
#endif | #endif | ||||
vm_object_zinit, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE); | vm_object_zinit, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE); | ||||
▲ Show 20 Lines • Show All 626 Lines • ▼ Show 20 Lines | vm_object_terminate(vm_object_t object) | ||||
KASSERT((object->flags & OBJ_DEAD) != 0, | KASSERT((object->flags & OBJ_DEAD) != 0, | ||||
("terminating non-dead obj %p", object)); | ("terminating non-dead obj %p", object)); | ||||
KASSERT((object->flags & OBJ_COLLAPSING) == 0, | KASSERT((object->flags & OBJ_COLLAPSING) == 0, | ||||
("terminating collapsing obj %p", object)); | ("terminating collapsing obj %p", object)); | ||||
KASSERT(object->backing_object == NULL, | KASSERT(object->backing_object == NULL, | ||||
("terminating shadow obj %p", object)); | ("terminating shadow obj %p", object)); | ||||
/* | /* | ||||
* wait for the pageout daemon to be done with the object | * Wait for the pageout daemon and other current users to be | ||||
* done with the object. Note that new paging_in_progress | |||||
* users can come after this wait, but they must check | |||||
markj: s/should/must/.
Maybe we should have a vm_object_pip_add() wrapper to do the OBJ_DEAD check. | |||||
Done Inline ActionsMay be. I will look at this after the current patch lands. kib: May be. I will look at this after the current patch lands. | |||||
* OBJ_DEAD flag set (without unlocking the object), and avoid | |||||
* the object being terminated. | |||||
*/ | */ | ||||
vm_object_pip_wait(object, "objtrm"); | vm_object_pip_wait(object, "objtrm"); | ||||
KASSERT(!blockcount_read(&object->paging_in_progress), | |||||
("vm_object_terminate: pageout in progress")); | |||||
KASSERT(object->ref_count == 0, | KASSERT(object->ref_count == 0, | ||||
Done Inline ActionsWhy was this removed? References are more strict than pip. jeff: Why was this removed? References are more strict than pip. | |||||
Done Inline ActionsMy bad, restored. kib: My bad, restored. | |||||
("vm_object_terminate: object with references, ref_count=%d", | ("vm_object_terminate: object with references, ref_count=%d", | ||||
object->ref_count)); | object->ref_count)); | ||||
if ((object->flags & OBJ_PG_DTOR) == 0) | if ((object->flags & OBJ_PG_DTOR) == 0) | ||||
vm_object_terminate_pages(object); | vm_object_terminate_pages(object); | ||||
#if VM_NRESERVLEVEL > 0 | #if VM_NRESERVLEVEL > 0 | ||||
if (__predict_false(!LIST_EMPTY(&object->rvq))) | if (__predict_false(!LIST_EMPTY(&object->rvq))) | ||||
▲ Show 20 Lines • Show All 1,893 Lines • Show Last 20 Lines |
s/should/must/.
Maybe we should have a vm_object_pip_add() wrapper to do the OBJ_DEAD check.