Re: Improving OOM killer

David Rientjes
2010-02-04T21:39:17Z

On Thu, 4 Feb 2010, Jiri Kosina wrote:

> Why does OOM killer care about forkbombs *at all*?
>

Because the cumulative effects of a forkbomb are detrimental to the
system and the badness() heursitic favors large memory consumers very
heavily. Thus, the forkbomb is never really a strong candidate for oom
kill since the parent may consume very little memory itself and meanwhile
KDE or another large memory consumer will get innocently killed instead as
a result.

> If we really want kernel to detect forkbombs (*), we'd have to establish
> completely separate infrastructure for that (with its own knobs for tuning
> and possibilities of disabling it completely).
>

That's what we're trying to do, we can look at the shear number of
children that the parent has forked and check for it to be over a certain
"forkbombing threshold" (which, yes, can be tuned from userspace), the
uptime of those children, their resident set size, etc., to attempt to
find a sane heuristic that penalizes them.