- 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.
c3feb36 kernel - Implement a more comprehensive low-memory deadlock solution
sys/vm/vm_pageout.c | 201 ++++++++++++++++++++++++++++++++++++++++++++++------
1 file changed, 181 insertions(+), 20 deletions(-)