Changeset View
Changeset View
Standalone View
Standalone View
vm/vm_object.c
Context not available. | |||||
("object %p has reservations", | ("object %p has reservations", | ||||
object)); | object)); | ||||
#endif | #endif | ||||
KASSERT(vm_object_cache_is_empty(object), | |||||
("object %p has cached pages", | |||||
object)); | |||||
KASSERT(object->paging_in_progress == 0, | KASSERT(object->paging_in_progress == 0, | ||||
("object %p paging_in_progress = %d", | ("object %p paging_in_progress = %d", | ||||
object, object->paging_in_progress)); | object, object->paging_in_progress)); | ||||
Context not available. | |||||
object->paging_in_progress = 0; | object->paging_in_progress = 0; | ||||
object->resident_page_count = 0; | object->resident_page_count = 0; | ||||
object->shadow_count = 0; | object->shadow_count = 0; | ||||
object->cache.rt_root = 0; | |||||
object->cache.rt_flags = 0; | |||||
mtx_lock(&vm_object_list_mtx); | mtx_lock(&vm_object_list_mtx); | ||||
TAILQ_INSERT_TAIL(&vm_object_list, object, object_list); | TAILQ_INSERT_TAIL(&vm_object_list, object, object_list); | ||||
Context not available. | |||||
if (__predict_false(!LIST_EMPTY(&object->rvq))) | if (__predict_false(!LIST_EMPTY(&object->rvq))) | ||||
vm_reserv_break_all(object); | vm_reserv_break_all(object); | ||||
#endif | #endif | ||||
if (__predict_false(!vm_object_cache_is_empty(object))) | |||||
vm_page_cache_free(object, 0, 0); | |||||
KASSERT(object->cred == NULL || object->type == OBJT_DEFAULT || | KASSERT(object->cred == NULL || object->type == OBJT_DEFAULT || | ||||
object->type == OBJT_SWAP, | object->type == OBJT_SWAP, | ||||
Context not available. | |||||
} else if ((tobject->flags & OBJ_UNMANAGED) != 0) | } else if ((tobject->flags & OBJ_UNMANAGED) != 0) | ||||
goto unlock_tobject; | goto unlock_tobject; | ||||
m = vm_page_lookup(tobject, tpindex); | m = vm_page_lookup(tobject, tpindex); | ||||
if (m == NULL && advise == MADV_WILLNEED) { | |||||
/* | |||||
* If the page is cached, reactivate it. | |||||
*/ | |||||
m = vm_page_alloc(tobject, tpindex, VM_ALLOC_IFCACHED | | |||||
VM_ALLOC_NOBUSY); | |||||
} | |||||
if (m == NULL) { | if (m == NULL) { | ||||
/* | /* | ||||
* There may be swap even if there is no backing page | * There may be swap even if there is no backing page | ||||
Context not available. | |||||
swap_pager_copy(orig_object, new_object, offidxstart, 0); | swap_pager_copy(orig_object, new_object, offidxstart, 0); | ||||
TAILQ_FOREACH(m, &new_object->memq, listq) | TAILQ_FOREACH(m, &new_object->memq, listq) | ||||
vm_page_xunbusy(m); | vm_page_xunbusy(m); | ||||
/* | |||||
* Transfer any cached pages from orig_object to new_object. | |||||
* If swap_pager_copy() found swapped out pages within the | |||||
* specified range of orig_object, then it changed | |||||
* new_object's type to OBJT_SWAP when it transferred those | |||||
* pages to new_object. Otherwise, new_object's type | |||||
* should still be OBJT_DEFAULT and orig_object should not | |||||
* contain any cached pages within the specified range. | |||||
*/ | |||||
if (__predict_false(!vm_object_cache_is_empty(orig_object))) | |||||
vm_page_cache_transfer(orig_object, offidxstart, | |||||
new_object); | |||||
} | } | ||||
VM_OBJECT_WUNLOCK(orig_object); | VM_OBJECT_WUNLOCK(orig_object); | ||||
VM_OBJECT_WUNLOCK(new_object); | VM_OBJECT_WUNLOCK(new_object); | ||||
Context not available. | |||||
backing_object, | backing_object, | ||||
object, | object, | ||||
OFF_TO_IDX(object->backing_object_offset), TRUE); | OFF_TO_IDX(object->backing_object_offset), TRUE); | ||||
/* | |||||
* Free any cached pages from backing_object. | |||||
*/ | |||||
if (__predict_false( | |||||
!vm_object_cache_is_empty(backing_object))) | |||||
vm_page_cache_free(backing_object, 0, 0); | |||||
} | } | ||||
/* | /* | ||||
* Object now shadows whatever backing_object did. | * Object now shadows whatever backing_object did. | ||||
Context not available. | |||||
(options & (OBJPR_CLEANONLY | OBJPR_NOTMAPPED)) == OBJPR_NOTMAPPED, | (options & (OBJPR_CLEANONLY | OBJPR_NOTMAPPED)) == OBJPR_NOTMAPPED, | ||||
("vm_object_page_remove: illegal options for object %p", object)); | ("vm_object_page_remove: illegal options for object %p", object)); | ||||
if (object->resident_page_count == 0) | if (object->resident_page_count == 0) | ||||
goto skipmemq; | return; | ||||
vm_object_pip_add(object, 1); | vm_object_pip_add(object, 1); | ||||
again: | again: | ||||
p = vm_page_find_least(object, start); | p = vm_page_find_least(object, start); | ||||
Context not available. | |||||
vm_page_unlock(p); | vm_page_unlock(p); | ||||
} | } | ||||
vm_object_pip_wakeup(object); | vm_object_pip_wakeup(object); | ||||
skipmemq: | |||||
if (__predict_false(!vm_object_cache_is_empty(object))) | |||||
vm_page_cache_free(object, start, end); | |||||
} | } | ||||
/* | /* | ||||
Context not available. |