From: David Rientjes <rientjes@google.com>
To: Michal Hocko <mhocko@suse.cz>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Johannes Weiner <hannes@cmpxchg.org>,
KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>,
linux-kernel@vger.kernel.org, linux-mm@kvack.org,
cgroups@vger.kernel.org
Subject: Re: [patch] mm, memcg: add oom killer delay
Date: Fri, 31 May 2013 03:22:59 -0700 (PDT) [thread overview]
Message-ID: <alpine.DEB.2.02.1305310316210.27716@chino.kir.corp.google.com> (raw)
In-Reply-To: <20130531081052.GA32491@dhcp22.suse.cz>
On Fri, 31 May 2013, Michal Hocko wrote:
> I have always discouraged people from running oom handler in the same
> memcg (or even in the same hierarchy).
>
We allow users to control their own memcgs by chowning them, so they must
be run in the same hierarchy if they want to run their own userspace oom
handler. There's nothing in the kernel that prevents that and the user
has no other option but to run in a parent cgroup.
> Yes, mmap_sem is tricky. Nothing in the proc code should take it for
> writing and charges are done with mmap_sem held for reading but that
> doesn't prevent from non-oom thread to try to get it for writing which
> would block also all future readers. We have also seen i_mutex being
> held during charge so you have to be careful about that one as well but
> I am not aware of other locks that could be a problem.
>
> The question is, do you really need to open any /proc/<pid>/ files which
> depend on mmap_sem (e.g. maps, smaps). /proc/<pid>/status should tell you
> about used memory. Or put it another way around. What kind of data you
> need for your OOM handler?
>
It's too easy to simply do even a "ps ax" in an oom memcg and make that
thread completely unresponsive because it allocates memory.
> I might be thinking about different use cases but user space OOM
> handlers I have seen so far had quite a good idea what is going on
> in the group and who to kill.
Then perhaps I'm raising constraints that you've never worked with, I
don't know. We choose to have a priority-based approach that is inherited
by children; this priority is kept in userspace and and the oom handler
would naturally need to know the set of tasks in the oom memcg at the time
of oom and their parent-child relationship. These priorities are
completely independent of memory usage.
> > If the oom notifier is in the oom cgroup, it may not be able to
> > successfully read the memcg "tasks" file to even determine the set of
> > eligible processes.
>
> It would have to use preallocated buffer and have mlocked all the memory
> that will be used during oom event.
>
Wrong, the kernel itself allocates memory when reading this information
and that would fail in an oom memcg.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2013-05-31 10:23 UTC|newest]
Thread overview: 47+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-30 1:18 David Rientjes
2013-05-30 15:07 ` Michal Hocko
2013-05-30 20:47 ` David Rientjes
2013-05-31 8:10 ` Michal Hocko
2013-05-31 10:22 ` David Rientjes [this message]
2013-05-31 11:02 ` Michal Hocko
2013-05-31 11:21 ` Michal Hocko
2013-05-31 19:29 ` David Rientjes
2013-06-01 6:11 ` Johannes Weiner
2013-06-01 10:29 ` Michal Hocko
2013-06-01 15:15 ` Johannes Weiner
2013-06-03 15:34 ` Michal Hocko
2013-06-03 16:48 ` Johannes Weiner
2013-06-03 18:03 ` Michal Hocko
2013-06-03 18:30 ` Johannes Weiner
2013-06-03 21:33 ` KOSAKI Motohiro
2013-06-04 9:17 ` Michal Hocko
2013-06-04 18:48 ` Johannes Weiner
2013-06-04 19:27 ` Michal Hocko
2013-06-05 13:49 ` Michal Hocko
2013-06-03 16:31 ` Michal Hocko
2013-06-03 16:51 ` Johannes Weiner
2013-06-01 10:20 ` Michal Hocko
2013-06-03 18:18 ` David Rientjes
2013-06-03 18:54 ` Johannes Weiner
2013-06-03 19:09 ` David Rientjes
2013-06-03 21:43 ` Johannes Weiner
2013-06-03 19:31 ` Michal Hocko
2013-06-03 21:17 ` David Rientjes
2013-06-04 9:55 ` Michal Hocko
2013-06-05 6:40 ` David Rientjes
2013-06-05 9:39 ` Michal Hocko
2013-06-06 0:09 ` David Rientjes
2013-06-10 14:23 ` Michal Hocko
2013-06-11 20:33 ` David Rientjes
2013-06-12 20:23 ` Michal Hocko
2013-06-12 21:27 ` David Rientjes
2013-06-13 15:16 ` Michal Hocko
2013-06-13 22:25 ` David Rientjes
2013-06-14 0:56 ` Kamezawa Hiroyuki
2013-06-14 10:12 ` David Rientjes
2013-06-19 21:30 ` David Rientjes
2013-06-25 1:39 ` Kamezawa Hiroyuki
2013-06-26 23:18 ` David Rientjes
2013-07-10 11:23 ` Michal Hocko
2013-05-31 21:46 ` Andrew Morton
2013-06-03 18:00 ` David Rientjes
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alpine.DEB.2.02.1305310316210.27716@chino.kir.corp.google.com \
--to=rientjes@google.com \
--cc=akpm@linux-foundation.org \
--cc=cgroups@vger.kernel.org \
--cc=hannes@cmpxchg.org \
--cc=kamezawa.hiroyu@jp.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@suse.cz \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox