aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Schultz <das@FreeBSD.org>2003-05-19 00:51:07 +0000
committerDavid Schultz <das@FreeBSD.org>2003-05-19 00:51:07 +0000
commite92686d065c611f9f46e6ee77623f02a4ead9c26 (patch)
tree7bcdaab4ffe7cef36b2928bf18a0c9e2fe3edff7
parent7f758dabbbf205c426f3f82c81245e306ecb294a (diff)
downloadsrc-e92686d065c611f9f46e6ee77623f02a4ead9c26.tar.gz
src-e92686d065c611f9f46e6ee77623f02a4ead9c26.zip
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)
Notes
Notes: svn path=/head/; revision=115146
-rw-r--r--sys/vm/vm_pageout.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/sys/vm/vm_pageout.c b/sys/vm/vm_pageout.c
index 9cfb24c8df67..f55a180c2cbf 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);