kernel - Implement a more comprehensive low-memory deadlock solution
authorMatthew Dillon <dillon@apollo.backplane.com>
Fri, 25 Aug 2017 05:25:02 +0000 (22:25 -0700)
committerMatthew Dillon <dillon@apollo.backplane.com>
Fri, 25 Aug 2017 05:25:02 +0000 (22:25 -0700)
commitc3feb36a35386093f8f28e8a125eab625bf825d3
tree59e247d9450ce02547ab8d947b96d1af1245614f
parent9b302485d4f8583183e666fd23820ad7eb08c968
kernel - Implement a more comprehensive low-memory deadlock solution

* Low memory deadlocks occur when the pageout daemon needs memory
  resources that the kernel cannot provide.  The pageout daemon itself
  is given more of an emergency reserve than other threads, but this
  is not sufficient.

  The complex nature of VFS's, particularly sohpisticated filesystems,
  can create situations where the pageout daemon gets stuck on locks
  held by filesystem related threads which themselves are stuck waiting
  for memory.

* Try to solve this problem by having two kernel pageout daemons.  The
  main daemon works as usual.  The second daemon monitors the first
  one looking for stalls and takes over if it detects one.

  The second daemon will skip problematic vnodes and only pageout
  anonymous memory.  At some point the main daemon will unstick and
  be able to resume normal operating.

* Paging anonymous memory is far less resource intensive than paging
  through a vnode, so it is far more likely that the emergency daemon
  will be able to make progress to resolve the low memory situation
  when the primary daemon gets stuck.
sys/vm/vm_pageout.c