Index: sys/uvm/uvm_pdaemon.c
===================================================================
RCS file: /cvsroot/src/sys/uvm/uvm_pdaemon.c,v
retrieving revision 1.110
diff -p -u -r1.110 uvm_pdaemon.c
--- sys/uvm/uvm_pdaemon.c 21 Apr 2019 15:32:18 -0000 1.110
+++ sys/uvm/uvm_pdaemon.c 25 Sep 2019 08:22:54 -0000
@@ -239,6 +239,7 @@ uvm_pageout(void *arg)
{
int npages = 0;
int extrapages = 0;
+ int timo = 0;
UVMHIST_FUNC("uvm_pageout"); UVMHIST_CALLED(pdhist);
@@ -270,15 +271,19 @@ uvm_pageout(void *arg)
bool needsscan, needsfree, kmem_va_starved;
kmem_va_starved = uvm_km_va_starved_p();
+ if (timo > 0 && kmem_va_starved)
+ printf("pagedaemon: Out of KVA, avaiting doom...\n");
mutex_spin_enter(&uvm_fpageqlock);
- if ((uvm_pagedaemon_waiters == 0 || uvmexp.paging > 0) &&
- !kmem_va_starved) {
+ if (timo > 0 ||
+ ((uvm_pagedaemon_waiters == 0 || uvmexp.paging > 0) &&
+ !kmem_va_starved)) {
UVMHIST_LOG(pdhist," <<SLEEPING>>",0,0,0,0);
UVM_UNLOCK_AND_WAIT(&uvm.pagedaemon,
- &uvm_fpageqlock, false, "pgdaemon", 0);
+ &uvm_fpageqlock, false, "pgdaemon", timo);
uvmexp.pdwoke++;
UVMHIST_LOG(pdhist," <<WOKE UP>>",0,0,0,0);
+ timo = 0;
} else {
mutex_spin_exit(&uvm_fpageqlock);
}
@@ -336,17 +341,16 @@ uvm_pageout(void *arg)
mutex_exit(&uvm_pageqlock);
/*
- * if we don't need free memory, we're done.
+ * if we still need free memory, kick the poll drainer thread
*/
- if (!needsfree && !kmem_va_starved)
- continue;
+ if (needsfree || kmem_va_starved)
+ uvmpd_pool_drain_wakeup();
/*
- * kick the pool drainer thread.
+ * sleep before next run
*/
-
- uvmpd_pool_drain_wakeup();
+ timo = hz/2;
}
/*NOTREACHED*/
}