diff options
author | Bob Beck <beck@cvs.openbsd.org> | 2009-08-08 13:44:00 +0000 |
---|---|---|
committer | Bob Beck <beck@cvs.openbsd.org> | 2009-08-08 13:44:00 +0000 |
commit | f516131b3cdc4a00d4665ce4b60d8b7cd6964b63 (patch) | |
tree | 185cb76e2f69c40f8c2d672cef8f3fcc775f7db1 /sys | |
parent | 68a547dbfae9686014f193330dae19d80e7a5d45 (diff) |
fix the page daemon to back off the buffer cache correctly even in the case
where we are below the inactive page target. This fixes a problem with a large
buffer cache on low memory machines where the the page daemon would woken up,
however the buffer cache would never be backed off because we were below the
inactive page target, which could result in constant paging and basically
a livelock condition.
ok oga@ art@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/uvm/uvm_pdaemon.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/sys/uvm/uvm_pdaemon.c b/sys/uvm/uvm_pdaemon.c index 000ef14d0a2..483ac2ae6ba 100644 --- a/sys/uvm/uvm_pdaemon.c +++ b/sys/uvm/uvm_pdaemon.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uvm_pdaemon.c,v 1.53 2009/08/02 16:28:40 beck Exp $ */ +/* $OpenBSD: uvm_pdaemon.c,v 1.54 2009/08/08 13:43:59 beck Exp $ */ /* $NetBSD: uvm_pdaemon.c,v 1.23 2000/08/20 10:24:14 bjh21 Exp $ */ /* @@ -212,6 +212,7 @@ uvm_pageout(void *arg) */ for (;;) { + int scanned = 0; uvm_lock_fpageq(); UVMHIST_LOG(pdhist," <<SLEEPING>>",0,0,0,0); msleep(&uvm.pagedaemon, &uvm.fpageqlock, PVM | PNORELOCK, @@ -241,13 +242,18 @@ uvm_pageout(void *arg) /* * get pages from the buffer cache, or scan if needed */ - if (uvmexp.inactive < uvmexp.inactarg) - uvmpd_scan(); - else if ((uvmexp.free - BUFPAGES_DEFICIT) < uvmexp.freetarg) { - if (bufbackoff() == -1) + if ((uvmexp.free - BUFPAGES_DEFICIT) < uvmexp.freetarg) { + if (bufbackoff() == -1) { uvmpd_scan(); + scanned = 1; + } else + scanned = 0; } + if (!scanned && (uvmexp.inactive < uvmexp.inactarg)) + uvmpd_scan(); + + /* * if there's any free memory to be had, * wake up any waiters. |