Re: [patch] mm, memcg: add oom killer delay

From: David Rientjes
Date: Mon Jun 03 2013 - 17:18:08 EST


On Mon, 3 Jun 2013, Michal Hocko wrote:

> > What do you suggest when you read the "tasks" file and it returns -ENOMEM
> > because kmalloc() fails because the userspace oom handler's memcg is also
> > oom?
>
> That would require that you track kernel allocations which is currently
> done only for explicit caches.
>

That will not always be the case, and I think this could be a prerequisite
patch for such support that we have internally. I'm not sure a userspace
oom notifier would want to keep a preallocated buffer around that is
mlocked in memory for all possible lengths of this file.

> > Obviously it's not a situation we want to get into, but unless you
> > know that handler's exact memory usage across multiple versions, nothing
> > else is sharing that memcg, and it's a perfect implementation, you can't
> > guarantee it. We need to address real world problems that occur in
> > practice.
>
> If you really need to have such a guarantee then you can have a _global_
> watchdog observing oom_control of all groups that provide such a vague
> requirements for oom user handlers.
>

The whole point is to allow the user to implement their own oom policy.
If the policy was completely encapsulated in kernel code, we don't need to
ever disable the oom killer even with memory.oom_control. Users may
choose to kill the largest process, the newest process, the oldest
process, sacrifice children instead of parents, prevent forkbombs,
implement their own priority scoring (which is what we do), kill the
allocating task, etc.

To not merge this patch, I'd ask that you show an alternative that allows
users to implement their own userspace oom handlers and not require admin
intervention when things go wrong.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/