summaryrefslogtreecommitdiffstats
path: root/sys/vm/vm_pageout.c
diff options
context:
space:
mode:
authordillon <dillon@FreeBSD.org>2001-06-09 18:06:58 +0000
committerdillon <dillon@FreeBSD.org>2001-06-09 18:06:58 +0000
commit3d6ba4564bf239ad99f50088d7cad2ad6bc90092 (patch)
treed94b91b47c5666d6800efb64de3961ab8db12c56 /sys/vm/vm_pageout.c
parentb87b49d4db0c558a662d2405d6c74481bc36b2e9 (diff)
downloadFreeBSD-src-3d6ba4564bf239ad99f50088d7cad2ad6bc90092.zip
FreeBSD-src-3d6ba4564bf239ad99f50088d7cad2ad6bc90092.tar.gz
Two fixes to the out-of-swap process termination code. First, start killing
processes a little earlier to avoid a deadlock. Second, when calculating the 'largest process' do not just count RSS. Instead count the RSS + SWAP used by the process. Without this the code tended to kill small inconsequential processes like, oh, sshd, rather then one of the many 'eatmem 200MB' I run on a whim :-). This fix has been extensively tested on -stable and somewhat tested on -current and will be MFCd in a few days. Shamed into fixing this by: ps
Diffstat (limited to 'sys/vm/vm_pageout.c')
-rw-r--r--sys/vm/vm_pageout.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/sys/vm/vm_pageout.c b/sys/vm/vm_pageout.c
index c1e9fec..dd96cb2 100644
--- a/sys/vm/vm_pageout.c
+++ b/sys/vm/vm_pageout.c
@@ -1139,8 +1139,8 @@ rescan0:
}
/*
- * make sure that we have swap space -- if we are low on memory and
- * swap -- then kill the biggest process.
+ * If we are out of swap and were not able to reach our paging
+ * target, kill the largest process.
*
* We keep the process bigproc locked once we find it to keep anyone
* from messing with it; however, there is a possibility of
@@ -1149,7 +1149,11 @@ 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
mtx_unlock(&vm_mtx);
bigproc = NULL;
bigsize = 0;
@@ -1184,7 +1188,8 @@ rescan0:
/*
* get the process size
*/
- size = vmspace_resident_count(p->p_vmspace);
+ size = vmspace_resident_count(p->p_vmspace) +
+ vmspace_swap_count(p->p_vmspace);
/*
* if the this process is bigger than the biggest one
* remember it.
OpenPOWER on IntegriCloud