Page MenuHomeFreeBSD

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

Authored by ota_j.email.ne.jp on Aug 2 2020, 3:58 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Mar 28, 9:55 AM
Unknown Object (File)
Dec 22 2023, 2:44 AM
Unknown Object (File)
Dec 13 2023, 3:34 AM
Unknown Object (File)
Oct 2 2023, 9:00 PM
Unknown Object (File)
Aug 6 2023, 7:31 AM
Unknown Object (File)
Jun 23 2023, 5:12 PM
Unknown Object (File)
Mar 4 2023, 11:13 AM
Unknown Object (File)
Mar 1 2023, 4:09 PM

Details

Reviewers
markj
kib
dougm
Summary

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
threshing.

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

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No 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.