Changeset View
Changeset View
Standalone View
Standalone View
head/sys/vm/vm_page.c
Show First 20 Lines • Show All 2,929 Lines • ▼ Show 20 Lines | |||||
u_int | u_int | ||||
vm_wait_count(void) | vm_wait_count(void) | ||||
{ | { | ||||
return (vm_severe_waiters + vm_min_waiters + vm_pageproc_waiters); | return (vm_severe_waiters + vm_min_waiters + vm_pageproc_waiters); | ||||
} | } | ||||
static void | void | ||||
vm_wait_doms(const domainset_t *wdoms) | vm_wait_doms(const domainset_t *wdoms) | ||||
{ | { | ||||
/* | /* | ||||
* We use racey wakeup synchronization to avoid expensive global | * We use racey wakeup synchronization to avoid expensive global | ||||
* locking for the pageproc when sleeping with a non-specific vm_wait. | * locking for the pageproc when sleeping with a non-specific vm_wait. | ||||
* To handle this, we only sleep for one tick in this instance. It | * To handle this, we only sleep for one tick in this instance. It | ||||
* is expected that most allocations for the pageproc will come from | * is expected that most allocations for the pageproc will come from | ||||
Show All 9 Lines | if (curproc == pageproc) { | ||||
/* | /* | ||||
* XXX Ideally we would wait only until the allocation could | * XXX Ideally we would wait only until the allocation could | ||||
* be satisfied. This condition can cause new allocators to | * be satisfied. This condition can cause new allocators to | ||||
* consume all freed pages while old allocators wait. | * consume all freed pages while old allocators wait. | ||||
*/ | */ | ||||
mtx_lock(&vm_domainset_lock); | mtx_lock(&vm_domainset_lock); | ||||
if (DOMAINSET_SUBSET(&vm_min_domains, wdoms)) { | if (DOMAINSET_SUBSET(&vm_min_domains, wdoms)) { | ||||
vm_min_waiters++; | vm_min_waiters++; | ||||
msleep(&vm_min_domains, &vm_domainset_lock, PVM, | msleep(&vm_min_domains, &vm_domainset_lock, | ||||
"vmwait", 0); | PVM | PDROP, "vmwait", 0); | ||||
} | } else | ||||
mtx_unlock(&vm_domainset_lock); | mtx_unlock(&vm_domainset_lock); | ||||
} | } | ||||
} | } | ||||
/* | /* | ||||
* vm_wait_domain: | * vm_wait_domain: | ||||
* | * | ||||
* Sleep until free pages are available for allocation. | * Sleep until free pages are available for allocation. | ||||
* - Called in various places after failed memory allocations. | * - Called in various places after failed memory allocations. | ||||
▲ Show 20 Lines • Show All 88 Lines • ▼ Show 20 Lines | |||||
* Sleep until free pages are available for allocation. | * Sleep until free pages are available for allocation. | ||||
* - Called only in vm_fault so that processes page faulting | * - Called only in vm_fault so that processes page faulting | ||||
* can be easily tracked. | * can be easily tracked. | ||||
* - Sleeps at a lower priority than vm_wait() so that vm_wait()ing | * - Sleeps at a lower priority than vm_wait() so that vm_wait()ing | ||||
* processes will be able to grab memory first. Do not change | * processes will be able to grab memory first. Do not change | ||||
* this balance without careful testing first. | * this balance without careful testing first. | ||||
*/ | */ | ||||
void | void | ||||
vm_waitpfault(void) | vm_waitpfault(struct domainset *dset) | ||||
{ | { | ||||
/* | |||||
* XXX Ideally we would wait only until the allocation could | |||||
* be satisfied. This condition can cause new allocators to | |||||
* consume all freed pages while old allocators wait. | |||||
*/ | |||||
mtx_lock(&vm_domainset_lock); | mtx_lock(&vm_domainset_lock); | ||||
if (vm_page_count_min()) { | if (DOMAINSET_SUBSET(&vm_min_domains, &dset->ds_mask)) { | ||||
vm_min_waiters++; | vm_min_waiters++; | ||||
msleep(&vm_min_domains, &vm_domainset_lock, PUSER, "pfault", 0); | msleep(&vm_min_domains, &vm_domainset_lock, PUSER | PDROP, | ||||
} | "pfault", 0); | ||||
} else | |||||
mtx_unlock(&vm_domainset_lock); | mtx_unlock(&vm_domainset_lock); | ||||
} | } | ||||
struct vm_pagequeue * | struct vm_pagequeue * | ||||
vm_page_pagequeue(vm_page_t m) | vm_page_pagequeue(vm_page_t m) | ||||
{ | { | ||||
return (&vm_pagequeue_domain(m)->vmd_pagequeues[m->queue]); | return (&vm_pagequeue_domain(m)->vmd_pagequeues[m->queue]); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 1,418 Lines • Show Last 20 Lines |