Fix bugs in dealing with low-memory situations when the system has run out
authorMatthew Dillon <dillon@apollo.backplane.com>
Thu, 18 Dec 2008 01:02:38 +0000 (17:02 -0800)
committerMatthew Dillon <dillon@apollo.backplane.com>
Thu, 18 Dec 2008 01:02:38 +0000 (17:02 -0800)
commitc84c24daf590138844d66151616b12dde7617c63
treeb27fc657f618eb72723690a4c91210aa564d7dc8
parent7cd8fd202adb2b9b6e256e2f191d746e30e04a2a
Fix bugs in dealing with low-memory situations when the system has run out
of swap or has no swap.

* Fix an error where the system started killing processes before it needed
  to.

* Continue propagating pages from the active queue to the inactive queue
  when the system has run out of swap or has no swap, even though the
  inactive queue has become bloated.  This occurs because the inactive
  queue may be unable to drain due to an excess of dirty pages which
  cannot be swapped out.

* Use the active queue to detect excessive stress which combined with
  an out-of-swap or no-swap situation means the system has run out of
  memory.  THEN start killing processes.

* This also allows the system to recycle nearly all the clean pages
  available when it has no swap space left, to try to keep things going,
  leaving only dirty pages in the VM page queues.
sys/vm/swap_pager.c
sys/vm/swap_pager.h
sys/vm/vm_pageout.c
sys/vm/vm_swap.c