Changeset View
Changeset View
Standalone View
Standalone View
head/sys/vm/vm_object.c
Show First 20 Lines • Show All 1,599 Lines • ▼ Show 20 Lines | for (;; pi++) { | ||||
else | else | ||||
pi = MIN(p->pindex, ps); | pi = MIN(p->pindex, ps); | ||||
new_pindex = pi - backing_offset_index; | new_pindex = pi - backing_offset_index; | ||||
if (new_pindex >= object->size) | if (new_pindex >= object->size) | ||||
break; | break; | ||||
/* | /* | ||||
* If the backing object page is busy a grandparent or older | |||||
* page may still be undergoing CoW. It is not safe to | |||||
* collapse the backing object until it is quiesced. | |||||
*/ | |||||
if (p != NULL && vm_page_busied(p)) | |||||
return (false); | |||||
/* | |||||
* See if the parent has the page or if the parent's object | * See if the parent has the page or if the parent's object | ||||
* pager has the page. If the parent has the page but the page | * pager has the page. If the parent has the page but the page | ||||
* is not valid, the parent's object pager must have the page. | * is not valid, the parent's object pager must have the page. | ||||
* | * | ||||
* If this fails, the parent does not completely shadow the | * If this fails, the parent does not completely shadow the | ||||
* object and we might as well give up now. | * object and we might as well give up now. | ||||
*/ | */ | ||||
pp = vm_page_lookup(object, new_pindex); | pp = vm_page_lookup(object, new_pindex); | ||||
▲ Show 20 Lines • Show All 286 Lines • ▼ Show 20 Lines | "backing_object %p was somehow re-referenced during collapse!", | ||||
vm_object_pip_wakeup(object); | vm_object_pip_wakeup(object); | ||||
counter_u64_add(object_collapses, 1); | counter_u64_add(object_collapses, 1); | ||||
} else { | } else { | ||||
/* | /* | ||||
* If we do not entirely shadow the backing object, | * If we do not entirely shadow the backing object, | ||||
* there is nothing we can do so we give up. | * there is nothing we can do so we give up. | ||||
*/ | */ | ||||
if (object->resident_page_count != object->size && | if (!vm_object_scan_all_shadowed(object)) { | ||||
!vm_object_scan_all_shadowed(object)) { | |||||
VM_OBJECT_WUNLOCK(backing_object); | VM_OBJECT_WUNLOCK(backing_object); | ||||
break; | break; | ||||
} | } | ||||
/* | /* | ||||
* Make the parent shadow the next object in the | * Make the parent shadow the next object in the | ||||
* chain. Deallocating backing_object will not remove | * chain. Deallocating backing_object will not remove | ||||
* it, since its reference count is at least 2. | * it, since its reference count is at least 2. | ||||
▲ Show 20 Lines • Show All 837 Lines • Show Last 20 Lines |