Index: uvm_pdaemon.c =================================================================== RCS file: /cvsroot/src/sys/uvm/uvm_pdaemon.c,v retrieving revision 1.107 diff -p -r1.107 uvm_pdaemon.c *** uvm_pdaemon.c 30 Jul 2012 23:56:48 -0000 1.107 --- uvm_pdaemon.c 5 Oct 2012 00:31:27 -0000 *************** uvm_pageout(void *arg) *** 232,237 **** --- 232,241 ---- int bufcnt, npages = 0; int extrapages = 0; struct pool *pp; + /* XXX make this sysctl read/write */ + int max_concurrent_loops = 1024; + /* XXX make this sysctl read */ + int current_loop = 0; UVMHIST_FUNC("uvm_pageout"); UVMHIST_CALLED(pdhist); *************** uvm_pageout(void *arg) *** 251,269 **** * main loop */ ! for (;;) { bool needsscan, needsfree, kmem_va_starved; kmem_va_starved = uvm_km_va_starved_p(); mutex_spin_enter(&uvm_fpageqlock); ! if ((uvm_pagedaemon_waiters == 0 || uvmexp.paging > 0) && ! !kmem_va_starved) { UVMHIST_LOG(pdhist," <>",0,0,0,0); UVM_UNLOCK_AND_WAIT(&uvm.pagedaemon, ! &uvm_fpageqlock, false, "pgdaemon", 0); uvmexp.pdwoke++; UVMHIST_LOG(pdhist," <>",0,0,0,0); } else { mutex_spin_exit(&uvm_fpageqlock); } --- 255,279 ---- * main loop */ ! for (;; current_loop++) { bool needsscan, needsfree, kmem_va_starved; kmem_va_starved = uvm_km_va_starved_p(); mutex_spin_enter(&uvm_fpageqlock); ! if (current_loop > max_concurrent_loops || ! ((uvm_pagedaemon_waiters == 0 || uvmexp.paging > 0) && ! !kmem_va_starved)) { ! int timo = 0; ! ! if (current_loop > max_concurrent_loops) ! timo = hz; UVMHIST_LOG(pdhist," <>",0,0,0,0); UVM_UNLOCK_AND_WAIT(&uvm.pagedaemon, ! &uvm_fpageqlock, false, "pgdaemon", timo); uvmexp.pdwoke++; UVMHIST_LOG(pdhist," <>",0,0,0,0); + current_loop = 0; } else { mutex_spin_exit(&uvm_fpageqlock); }