Page MenuHomeFreeBSD

Fault in the parent of zombie/killed processes before killing a process in OOM.
Needs ReviewPublic

Authored by on Aug 2 2020, 3:58 PM.



Even if a process is killed, its memory is not released until its parent process collects the zombie process.
Rather than killing more processes, give the parent a chance to collect and clean up by faulting in the parent.

Under heavily threshing condition, OOM ends up killing processes without releasing any memory as they just build up zombie processes.

Waking up parents speed up releasing of memory and the number of kills.

Test Plan

Use lower memory hardware or virtual environment with low memory to trigger

I have machines with 1GB ~ 3GB physical memory with 1GB ~ 2 GB swap space and 'make buildworld -j 20 ~ 30' usually trigger enough llvm compilations to run out of memory. I've been using this change for a while and checked the number of OOM kills from /var/log/message.

Diff Detail

rS FreeBSD src repository - subversion
Lint OK
No Unit Test Coverage
Build Status
Buildable 32704
Build 30151: arc lint + arc unit

Event Timeline

The change does not make sense. The address space of the process is destroyed in context of exit1(), see the call to vmspace_exit(). Zombies only hold the struct proc itself to record pid and exit code. So your change is both nop, and racy because p->p_pptr can become invalid any moment.