Re: Improving OOM killer

David Rientjes
2010-02-10T22:31:57Z

On Wed, 10 Feb 2010, Alan Cox wrote:

> One of the problems with picking on tasks that fork a lot is that
> describes apache perfectly. So a high loaded apache will get shot over a
> rapid memory eating cgi script.
>

With my rewrite, the oom killer would not select apache but rather the
child with a seperate address space that is consuming the most amount of
allowed memory and only when a configurable number of such children (1000
by default) have not had any runtime. My heuristic is only meant to
slightly penalize such tasks so that they can be distinguished from oom
kill from other parents with comparable memory usage. Enforcing a strict
forkbomb policy is out of the scope of the oom killer, though, so no
attempt was made.

> Any heuristic is going to be iffy - but that isn't IMHO a good one to
> work from. If anything "who allocated lots of RAM recently" may be a
> better guide but we don't keep stats for that.
>

That's what my heuristic basically does, if a parent is identified as a
forkbomb, then it is only penalized by averaging the memory consumption of
those children and then multiplying it by the same number of times the
configurable forkbomb threshold was reached.