diff options
author | das <das@FreeBSD.org> | 2003-05-19 00:51:07 +0000 |
---|---|---|
committer | das <das@FreeBSD.org> | 2003-05-19 00:51:07 +0000 |
commit | b8e4e0e3ab06d90ff08b0f841c8209a5d58c1dd4 (patch) | |
tree | 7bcdaab4ffe7cef36b2928bf18a0c9e2fe3edff7 | |
parent | 57b29f0e87b1631dbe03dd10a364831bf201554b (diff) | |
download | FreeBSD-src-b8e4e0e3ab06d90ff08b0f841c8209a5d58c1dd4.zip FreeBSD-src-b8e4e0e3ab06d90ff08b0f841c8209a5d58c1dd4.tar.gz |
If we seem to be out of VM, don't allow the pagedaemon to kill
processes in the first pass. Among other things, this will give
us a chance to launder vnode-backed pages before concluding that
we need more swap. This is particularly useful for systems that
have no swap.
While here, update a comment and remove some long-unused code.
Reported by: Lucky Green <shamrock@cypherpunks.to>
Suggested by: dillon
Approved by: re (rwatson)
-rw-r--r-- | sys/vm/vm_pageout.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/sys/vm/vm_pageout.c b/sys/vm/vm_pageout.c index 9cfb24c..f55a180 100644 --- a/sys/vm/vm_pageout.c +++ b/sys/vm/vm_pageout.c @@ -1162,8 +1162,11 @@ rescan0: } /* - * If we are out of swap and were not able to reach our paging - * target, kill the largest process. + * If we are critically low on one of RAM or swap and low on + * the other, kill the largest process. However, we avoid + * doing this on the first pass in order to give ourselves a + * chance to flush out dirty vnode-backed pages and to allow + * active pages to be moved to the inactive queue and reclaimed. * * We keep the process bigproc locked once we find it to keep anyone * from messing with it; however, there is a possibility of @@ -1172,11 +1175,9 @@ rescan0: * lock while walking this list. To avoid this, we don't block on * the process lock but just skip a process if it is already locked. */ - if ((vm_swap_size < 64 && vm_page_count_min()) || - (swap_pager_full && vm_paging_target() > 0)) { -#if 0 - if ((vm_swap_size < 64 || swap_pager_full) && vm_page_count_min()) { -#endif + if (pass != 0 && + ((vm_swap_size < 64 && vm_page_count_min()) || + (swap_pager_full && vm_paging_target() > 0))) { bigproc = NULL; bigsize = 0; sx_slock(&allproc_lock); |