From: Michal Hocko <mhocko@kernel.org>
To: Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>
Cc: Roman Gushchin <guro@fb.com>,
linux-mm@kvack.org, Johannes Weiner <hannes@cmpxchg.org>,
David Rientjes <rientjes@google.com>, Tejun Heo <tj@kernel.org>,
kernel-team@fb.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 3/3] mm, oom: introduce memory.oom.group
Date: Thu, 2 Aug 2018 14:14:46 +0200 [thread overview]
Message-ID: <20180802121446.GK10808@dhcp22.suse.cz> (raw)
In-Reply-To: <712a319f-c9da-230a-f2cb-af980daff704@i-love.sakura.ne.jp>
On Thu 02-08-18 20:53:14, Tetsuo Handa wrote:
> On 2018/08/02 20:21, Michal Hocko wrote:
> > On Thu 02-08-18 19:53:13, Tetsuo Handa wrote:
> >> On 2018/08/02 9:32, Roman Gushchin wrote:
> > [...]
> >>> +struct mem_cgroup *mem_cgroup_get_oom_group(struct task_struct *victim,
> >>> + struct mem_cgroup *oom_domain)
> >>> +{
> >>> + struct mem_cgroup *oom_group = NULL;
> >>> + struct mem_cgroup *memcg;
> >>> +
> >>> + if (!cgroup_subsys_on_dfl(memory_cgrp_subsys))
> >>> + return NULL;
> >>> +
> >>> + if (!oom_domain)
> >>> + oom_domain = root_mem_cgroup;
> >>> +
> >>> + rcu_read_lock();
> >>> +
> >>> + memcg = mem_cgroup_from_task(victim);
> >>
> >> Isn't this racy? I guess that memcg of this "victim" can change to
> >> somewhere else from the one as of determining the final candidate.
> >
> > How is this any different from the existing code? We select a victim and
> > then kill it. The victim might move away and won't be part of the oom
> > memcg anymore but we will still kill it. I do not remember this ever
> > being a problem. Migration is a privileged operation. If you loose this
> > restriction you shouldn't allow to move outside of the oom domain.
>
> The existing code kills one process (plus other processes sharing mm if any).
> But oom_cgroup kills multiple processes. Thus, whether we made decision based
> on correct memcg becomes important.
Yes but a proper configuration should already mitigate the harm because
you shouldn't be able to migrate the task outside of the oom domain.
A (oom.group = 1)
/ \
B C
moving task between B and C should be harmless while moving it out of A
subtree completely is a dubious configuration.
> >> This "victim" might have already passed exit_mm()/cgroup_exit() from do_exit().
> >
> > Why does this matter? The victim hasn't been killed yet so if it exists
> > by its own I do not think we really have to tear the whole cgroup down.
>
> The existing code does not send SIGKILL if find_lock_task_mm() failed. Who can
> guarantee that the victim is not inside do_exit() yet when this code is executed?
I do not follow. Why does this matter at all?
--
Michal Hocko
SUSE Labs
next prev parent reply other threads:[~2018-08-02 12:14 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-02 0:31 [PATCH v2 0/3] introduce memory.oom.group Roman Gushchin
2018-08-02 0:31 ` [PATCH v2 1/3] mm: introduce mem_cgroup_put() helper Roman Gushchin
2018-08-02 0:36 ` Stephen Rothwell
2018-08-02 0:47 ` Shakeel Butt
2018-08-02 0:50 ` Roman Gushchin
2018-08-06 21:44 ` David Rientjes
2018-08-02 0:32 ` [PATCH v2 2/3] mm, oom: refactor oom_kill_process() Roman Gushchin
2018-08-02 0:32 ` [PATCH v2 3/3] mm, oom: introduce memory.oom.group Roman Gushchin
2018-08-02 10:53 ` Tetsuo Handa
2018-08-02 11:21 ` Michal Hocko
2018-08-02 11:53 ` Tetsuo Handa
2018-08-02 12:14 ` Michal Hocko [this message]
2018-08-02 16:56 ` Roman Gushchin
2018-08-02 18:48 ` Tejun Heo
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=20180802121446.GK10808@dhcp22.suse.cz \
--to=mhocko@kernel.org \
--cc=guro@fb.com \
--cc=hannes@cmpxchg.org \
--cc=kernel-team@fb.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=penguin-kernel@i-love.sakura.ne.jp \
--cc=rientjes@google.com \
--cc=tj@kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).