diff --git a/sys/vm/vm_fault.c b/sys/vm/vm_fault.c index 79e122420adf..77e161514c2d 100644 --- a/sys/vm/vm_fault.c +++ b/sys/vm/vm_fault.c @@ -347,7 +347,7 @@ RetryFault:; if ((queue - fs.m->pc) == PQ_CACHE && vm_page_count_severe()) { vm_page_activate(fs.m); unlock_and_deallocate(&fs); - VM_WAIT; + VM_WAITPFAULT; goto RetryFault; } @@ -388,7 +388,7 @@ RetryFault:; } if (fs.m == NULL) { unlock_and_deallocate(&fs); - VM_WAIT; + VM_WAITPFAULT; goto RetryFault; } } diff --git a/sys/vm/vm_page.c b/sys/vm/vm_page.c index abc419455841..2c0052b9c867 100644 --- a/sys/vm/vm_page.c +++ b/sys/vm/vm_page.c @@ -967,6 +967,7 @@ loop: * vm_wait: (also see VM_WAIT macro) * * Block until free pages are available for allocation + * - Called in various places before memory allocations. */ void @@ -988,6 +989,28 @@ vm_wait(void) splx(s); } +/* + * vm_waitpfault: (also see VM_WAITPFAULT macro) + * + * Block until free pages are available for allocation + * - Called only in vm_fault so that processes page faulting + * can be easily tracked. + */ + +void +vm_waitpfault(void) +{ + int s; + + s = splvm(); + if (!vm_pages_needed) { + vm_pages_needed = 1; + wakeup(&vm_pages_needed); + } + tsleep(&cnt.v_free_count, PUSER, "pfault", 0); + splx(s); +} + /* * vm_page_activate: * diff --git a/sys/vm/vm_pageout.c b/sys/vm/vm_pageout.c index 57f22b2a8ba2..657f5e71a75c 100644 --- a/sys/vm/vm_pageout.c +++ b/sys/vm/vm_pageout.c @@ -1141,8 +1141,7 @@ rescan0: /* * if this is a system process, skip it */ - if ((p->p_flag & P_SYSTEM) || (p->p_lock > 0) || - (p->p_pid == 1) || + if ((p->p_flag & P_SYSTEM) || (p->p_pid == 1) || ((p->p_pid < 48) && (vm_swap_size != 0))) { PROC_UNLOCK(p); continue; diff --git a/sys/vm/vm_pageout.h b/sys/vm/vm_pageout.h index bfcfbb110a3f..fc88589d5976 100644 --- a/sys/vm/vm_pageout.h +++ b/sys/vm/vm_pageout.h @@ -100,7 +100,9 @@ extern int vm_pageout_deficit; extern void pagedaemon_wakeup __P((void)); #define VM_WAIT vm_wait() +#define VM_WAITPFAULT vm_waitpfault() extern void vm_wait __P((void)); +extern void vm_waitpfault __P((void)); #ifdef _KERNEL void vm_pageout_page __P((vm_page_t, vm_object_t));