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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 3 Jun 2013, Johannes Weiner wrote:

> > It's not necessarily harder if you assign the userspace oom handlers to 
> > the root of your subtree with access to more memory than the children.  
> > There is no "inability" to write a proper handler, but when you have 
> > dozens of individual users implementing their own userspace handlers with 
> > changing memcg limits over time, then you might find it hard to have 
> > perfection every time.  If we had perfection, we wouldn't have to worry 
> > about oom in the first place.  We can't just let these gazillion memcgs 
> > sit spinning forever because they get stuck, either.  That's why we've 
> > used this solution for years as a failsafe.  Disabling the oom killer 
> > entirely, even for a memcg, is ridiculous, and if you don't have a grace 
> > period then oom handlers themselves just don't work.
> 
> It's only ridiculous if your OOM handler is subject to the OOM
> situation it's trying to handle.
> 

You're suggesting the oom handler can't be subject to its own memcg 
limits, independent of the memcg it is handling?  If we demand that such a 
handler be attached to the root memcg, that breaks the memory isolation 
that memcg provides.  We constrain processes to a memcg for the purposes 
of that isolation, so it cannot use more resources than allotted.

> Don't act as if the oom disabling semantics were unreasonable or
> inconsistent with the rest of the system, memcgs were not really meant
> to be self-policed by the tasks running in them.  That's why we have
> the waitqueue, so that everybody sits there and waits until an outside
> force resolves the situation.  There is nothing wrong with that, you
> just have a new requirement.
> 

The waitqueue doesn't solve anything with regard to the memory, if the 
memcg sits there and deadlocks forever then it is using resources (memory, 
not cpu) that will never be freed.

> > I'm talking about the memory the kernel allocates when reading the "tasks" 
> > file, not userspace.  This can, and will, return -ENOMEM.
> 
> Do you mean due to kmem limitations?
> 

Yes.

> What we could do is allow one task in the group to be the dedicated
> OOM handler.  If we catch this task in the charge path during an OOM
> situation, we fall back to the kernel OOM handler.
> 

I'm not sure it even makes sense to have more than one oom handler per 
memcg and the synchronization that requires in userspace to get the right 
result, so I didn't consider dedicating a single oom handler.  That would 
be an entirely new interface, though, since we may have multiple processes 
waiting on memory.oom_control that aren't necessarily handlers; they grab 
a snapshot of memory, do logging, etc.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]