diff options
-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. |