kernel - Fix several low memory+swap pageout/killproc issues
commit9cd626ca5e5f0de130507ac57f5f9304a441658e
authorMatthew Dillon <dillon@apollo.backplane.com>
Thu, 20 Aug 2015 23:45:27 +0000 (20 16:45 -0700)
committerMatthew Dillon <dillon@apollo.backplane.com>
Thu, 20 Aug 2015 23:52:17 +0000 (20 16:52 -0700)
treea361d029ef732f1938679cc5ca7c15a3a6e075da
parentd46ba01e9cb8841869e56e6cbb89191491e9371e
kernel - Fix several low memory+swap pageout/killproc issues

* Add significant slop to the PQAVERAGE() calculation in the
  pageout daemon and increase the slop in the vm_paging_target()
  test the pageout daemon makes to determine if it can stop early.

  These adjustments fix a degenerate case when no swap is configured
  and a large number of clean pages are present in the inactive queue
  which could prevent the pageout daemon from cleaning a sufficient number
  of pages and cause it to start killing processes even when plenty of
  freeable memory exists.

* Impose a one-second delay when killing processes due to insufficient
  memory + swap.  This reduces the chance that multiple processes will
  be killed even if the first one would have been sufficient by giving
  the kernel more time to dipose of the process.

* Fix a bug in vm_page_alloc().  When v_free_count exactly matches
  v_free_reserved it successfully passes the vm_page_count_target()
  test but vm_page_alloc() will still fail.  This results in a livelock
  in vm_fault_object() and will livelock the pageout daemon vs a user
  process stuck in vm_fault(), causing the machine to lock.

  Fixed by adjusting the conditional test in vm_page_alloc().

Reported-by: luxh
sys/vm/vm_page.c
sys/vm/vm_pageout.c