Index: uvm/uvm_extern.h =================================================================== RCS file: /cvsroot/src/sys/uvm/uvm_extern.h,v retrieving revision 1.231 diff -p -u -r1.231 uvm_extern.h --- uvm/uvm_extern.h 14 Aug 2020 09:06:15 -0000 1.231 +++ uvm/uvm_extern.h 18 Dec 2020 03:29:16 -0000 @@ -398,7 +398,7 @@ struct uvmexp { /* daemon counters. XXX: should be 64-bit counters */ int pdwoke; /* number of times daemon woke up */ int pdrevs; /* number of times daemon rev'd clock hand */ - int _unused3; + int pdkeeprun; /* number of times daemon did not sleep */ int pdfreed; /* number of pages daemon freed since boot */ int pdscans; /* number of pages daemon scanned since boot */ int pdanscan; /* number of anonymous pages scanned by daemon */ @@ -411,6 +411,9 @@ struct uvmexp { int pdreanon; /* anon pages reactivated due to thresholds */ int pdrefile; /* file pages reactivated due to thresholds */ int pdreexec; /* executable pages reactivated due to thresholds */ + int pdplwoke; /* number of times pool drain thread woke up */ + int pdplcycled; /* number of times pool drain cycled all pools */ + int pdpldrained;/* number of times pool_drain() called */ int bootpages; /* number of pages stolen at boot */ }; Index: uvm/uvm_pdaemon.c =================================================================== RCS file: /cvsroot/src/sys/uvm/uvm_pdaemon.c,v retrieving revision 1.131 diff -p -u -r1.131 uvm_pdaemon.c --- uvm/uvm_pdaemon.c 4 Nov 2020 01:30:19 -0000 1.131 +++ uvm/uvm_pdaemon.c 18 Dec 2020 03:29:16 -0000 @@ -282,6 +282,7 @@ uvm_pageout(void *arg) UVMHIST_LOG(pdhist," <>",0,0,0,0); } else { mutex_spin_exit(&uvmpd_lock); + uvmexp.pdkeeprun++; } /* @@ -1020,12 +1021,12 @@ uvmpd_pool_drain_thread(void *arg) if (!uvmpd_pool_drain_run) { lastslept = getticks(); cv_wait(&uvmpd_pool_drain_cv, &uvmpd_lock); + uvmexp.pdplwoke++; if (getticks() != lastslept) { cycled = false; firstpool = NULL; } } - uvmpd_pool_drain_run = false; mutex_exit(&uvmpd_lock); /* @@ -1034,6 +1035,7 @@ uvmpd_pool_drain_thread(void *arg) */ if (cycled) { kpause("uvmpdlmt", false, 1, NULL); + uvmexp.pdplcycled++; cycled = false; firstpool = NULL; } @@ -1058,6 +1060,7 @@ uvmpd_pool_drain_thread(void *arg) * drain a pool, and then re-enable the freelist cache. */ (void)pool_drain(&curpool); + uvmexp.pdpldrained++; KASSERT(curpool != NULL); if (firstpool == NULL) { firstpool = curpool; @@ -1065,6 +1068,11 @@ uvmpd_pool_drain_thread(void *arg) cycled = true; } uvm_pgflcache_resume(); + + uvmpd_pool_drain_run = + (uvm_km_va_starved_p() || + uvm_availmem(false) + uvmexp.paging < uvmexp.freetarg); + yield(); } /*NOTREACHED*/ } Index: uvm/uvm_stat.c =================================================================== RCS file: /cvsroot/src/sys/uvm/uvm_stat.c,v retrieving revision 1.46 diff -p -u -r1.46 uvm_stat.c --- uvm/uvm_stat.c 14 Jun 2020 21:41:42 -0000 1.46 +++ uvm/uvm_stat.c 18 Dec 2020 03:29:16 -0000 @@ -133,8 +133,10 @@ uvmexp_print(void (*pr)(const char *, .. uvmexp.pdanscan); (*pr)(" busy=%d, freed=%d, reactivate=%d, deactivate=%d\n", uvmexp.pdbusy, uvmexp.pdfreed, uvmexp.pdreact, uvmexp.pddeact); - (*pr)(" pageouts=%d, pending=%d, nswget=%d\n", uvmexp.pdpageouts, - uvmexp.pdpending, uvmexp.nswget); + (*pr)(" pageouts=%d, pending=%d, nswget=%d, keeprun=%d\n", + uvmexp.pdpageouts, uvmexp.pdpending, uvmexp.nswget, uvmexp.pdkeeprun); + (*pr)(" pdplwoke=%d, pdplcycled=%d, pdpldrained=%d\n", + uvmexp.pdplwoke, uvmexp.pdplcycled, uvmexp.pdpldrained); (*pr)(" nswapdev=%d, swpgavail=%d\n", uvmexp.nswapdev, uvmexp.swpgavail); (*pr)(" swpages=%d, swpginuse=%d, swpgonly=%d, paging=%d\n",