Index: uvm_pdaemon.c =================================================================== RCS file: /cvsroot/src/sys/uvm/uvm_pdaemon.c,v retrieving revision 1.125 diff -p -u -r1.125 uvm_pdaemon.c --- uvm_pdaemon.c 23 Feb 2020 15:46:43 -0000 1.125 +++ uvm_pdaemon.c 2 Mar 2020 14:53:24 -0000 @@ -244,6 +244,7 @@ uvm_pageout(void *arg) int npages = 0; int extrapages = 0; int fpages; + int timo = 0; UVMHIST_FUNC("uvm_pageout"); UVMHIST_CALLED(pdhist); @@ -273,15 +274,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(&uvmpd_lock); - 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," <>",0,0,0,0); UVM_UNLOCK_AND_WAIT(&uvm.pagedaemon, - &uvmpd_lock, false, "pgdaemon", 0); + &uvmpd_lock, false, "pgdaemon", timo); uvmexp.pdwoke++; UVMHIST_LOG(pdhist," <>",0,0,0,0); + timo = 0; } else { mutex_spin_exit(&uvmpd_lock); } @@ -329,17 +334,16 @@ uvm_pageout(void *arg) } /* - * scan done. if we don't need free memory, we're done. + * if we don't 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*/ }