Changeset View
Changeset View
Standalone View
Standalone View
head/sys/vm/vm_object.c
Show First 20 Lines • Show All 1,287 Lines • ▼ Show 20 Lines | if (vm_page_tryxbusy(tm) == 0) { | ||||
* sleeping so that the page daemon is less | * sleeping so that the page daemon is less | ||||
* likely to reclaim it. | * likely to reclaim it. | ||||
*/ | */ | ||||
vm_page_aflag_set(tm, PGA_REFERENCED); | vm_page_aflag_set(tm, PGA_REFERENCED); | ||||
} | } | ||||
vm_page_busy_sleep(tm, "madvpo", false); | vm_page_busy_sleep(tm, "madvpo", false); | ||||
goto relookup; | goto relookup; | ||||
} | } | ||||
vm_page_lock(tm); | |||||
vm_page_advise(tm, advice); | vm_page_advise(tm, advice); | ||||
vm_page_unlock(tm); | |||||
vm_page_xunbusy(tm); | vm_page_xunbusy(tm); | ||||
vm_object_madvise_freespace(tobject, advice, tm->pindex, 1); | vm_object_madvise_freespace(tobject, advice, tm->pindex, 1); | ||||
next_pindex: | next_pindex: | ||||
if (tobject != object) | if (tobject != object) | ||||
VM_OBJECT_WUNLOCK(tobject); | VM_OBJECT_WUNLOCK(tobject); | ||||
} | } | ||||
VM_OBJECT_WUNLOCK(object); | VM_OBJECT_WUNLOCK(object); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 747 Lines • ▼ Show 20 Lines | |||||
* This operation should only be performed on objects that | * This operation should only be performed on objects that | ||||
* contain non-fictitious, managed pages. | * contain non-fictitious, managed pages. | ||||
* | * | ||||
* The object must be locked. | * The object must be locked. | ||||
*/ | */ | ||||
void | void | ||||
vm_object_page_noreuse(vm_object_t object, vm_pindex_t start, vm_pindex_t end) | vm_object_page_noreuse(vm_object_t object, vm_pindex_t start, vm_pindex_t end) | ||||
{ | { | ||||
struct mtx *mtx; | |||||
vm_page_t p, next; | vm_page_t p, next; | ||||
VM_OBJECT_ASSERT_LOCKED(object); | VM_OBJECT_ASSERT_LOCKED(object); | ||||
KASSERT((object->flags & (OBJ_FICTITIOUS | OBJ_UNMANAGED)) == 0, | KASSERT((object->flags & (OBJ_FICTITIOUS | OBJ_UNMANAGED)) == 0, | ||||
("vm_object_page_noreuse: illegal object %p", object)); | ("vm_object_page_noreuse: illegal object %p", object)); | ||||
if (object->resident_page_count == 0) | if (object->resident_page_count == 0) | ||||
return; | return; | ||||
p = vm_page_find_least(object, start); | p = vm_page_find_least(object, start); | ||||
/* | /* | ||||
* Here, the variable "p" is either (1) the page with the least pindex | * Here, the variable "p" is either (1) the page with the least pindex | ||||
* greater than or equal to the parameter "start" or (2) NULL. | * greater than or equal to the parameter "start" or (2) NULL. | ||||
*/ | */ | ||||
mtx = NULL; | |||||
for (; p != NULL && (p->pindex < end || end == 0); p = next) { | for (; p != NULL && (p->pindex < end || end == 0); p = next) { | ||||
next = TAILQ_NEXT(p, listq); | next = TAILQ_NEXT(p, listq); | ||||
vm_page_change_lock(p, &mtx); | |||||
vm_page_deactivate_noreuse(p); | vm_page_deactivate_noreuse(p); | ||||
} | } | ||||
if (mtx != NULL) | |||||
mtx_unlock(mtx); | |||||
} | } | ||||
/* | /* | ||||
* Populate the specified range of the object with valid pages. Returns | * Populate the specified range of the object with valid pages. Returns | ||||
* TRUE if the range is successfully populated and FALSE otherwise. | * TRUE if the range is successfully populated and FALSE otherwise. | ||||
* | * | ||||
* Note: This function should be optimized to pass a larger array of | * Note: This function should be optimized to pass a larger array of | ||||
* pages to vm_pager_get_pages() before it is applied to a non- | * pages to vm_pager_get_pages() before it is applied to a non- | ||||
▲ Show 20 Lines • Show All 672 Lines • Show Last 20 Lines |