From: Roman Gushchin <guro@fb.com>
To: David Rientjes <rientjes@google.com>
Cc: linux-mm@kvack.org, Michal Hocko <mhocko@kernel.org>,
Vladimir Davydov <vdavydov.dev@gmail.com>,
Johannes Weiner <hannes@cmpxchg.org>,
Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>,
Tejun Heo <tj@kernel.org>,
kernel-team@fb.com, cgroups@vger.kernel.org,
linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [v5 2/4] mm, oom: cgroup-aware OOM killer
Date: Tue, 15 Aug 2017 13:15:58 +0100 [thread overview]
Message-ID: <20170815121558.GA15892@castle.dhcp.TheFacebook.com> (raw)
In-Reply-To: <alpine.DEB.2.10.1708141532300.63207@chino.kir.corp.google.com>
On Mon, Aug 14, 2017 at 03:42:54PM -0700, David Rientjes wrote:
> On Mon, 14 Aug 2017, Roman Gushchin wrote:
> > +
> > +static long oom_evaluate_memcg(struct mem_cgroup *memcg,
> > + const nodemask_t *nodemask)
> > +{
> > + struct css_task_iter it;
> > + struct task_struct *task;
> > + int elegible = 0;
> > +
> > + css_task_iter_start(&memcg->css, 0, &it);
> > + while ((task = css_task_iter_next(&it))) {
> > + /*
> > + * If there are no tasks, or all tasks have oom_score_adj set
> > + * to OOM_SCORE_ADJ_MIN and oom_kill_all_tasks is not set,
> > + * don't select this memory cgroup.
> > + */
> > + if (!elegible &&
> > + (memcg->oom_kill_all_tasks ||
> > + task->signal->oom_score_adj != OOM_SCORE_ADJ_MIN))
> > + elegible = 1;
>
> I'm curious about the decision made in this conditional and how
> oom_kill_memcg_member() ignores task->signal->oom_score_adj. It means
> that memory.oom_kill_all_tasks overrides /proc/pid/oom_score_adj if it
> should otherwise be disabled.
>
> It's undocumented in the changelog, but I'm questioning whether it's the
> right decision. Doesn't it make sense to kill all tasks that are not oom
> disabled, and allow the user to still protect certain processes by their
> /proc/pid/oom_score_adj setting? Otherwise, there's no way to do that
> protection without a sibling memcg and its own reservation of memory. I'm
> thinking about a process that governs jobs inside the memcg and if there
> is an oom kill, it wants to do logging and any cleanup necessary before
> exiting itself. It seems like a powerful combination if coupled with oom
> notification.
Good question!
I think, that an ability to override any oom_score_adj value and get all tasks
killed is more important, than an ability to kill all processes with some
exceptions.
In your example someone still needs to look after the remaining process,
and kill it after some timeout, if it will not quit by itself, right?
The special treatment of the -1000 value (without oom_kill_all_tasks)
is required only to not to break the existing setups.
Generally, oom_score_adj should have a meaning only on a cgroup level,
so extending it to the system level doesn't sound as a good idea.
>
> Also, s/elegible/eligible/
Shame on me :)
Will fix, thanks!
>
> Otherwise, looks good!
Great!
Thank you for the reviewing and testing.
Roman
--
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:[~2017-08-15 12:16 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-14 18:32 [v5 1/4] mm, oom: refactor the oom_kill_process() function Roman Gushchin
2017-08-14 18:32 ` [v5 0/4] cgroup-aware OOM killer Roman Gushchin
2017-08-14 18:32 ` [v5 2/4] mm, oom: " Roman Gushchin
2017-08-14 22:42 ` David Rientjes
2017-08-15 12:15 ` Roman Gushchin [this message]
2017-08-15 12:20 ` Aleksa Sarai
2017-08-15 12:57 ` Roman Gushchin
2017-08-15 21:47 ` David Rientjes
2017-08-16 15:43 ` Roman Gushchin
2017-08-21 0:50 ` David Rientjes
2017-08-21 9:46 ` Roman Gushchin
2017-08-22 17:03 ` Johannes Weiner
2017-08-23 16:20 ` Roman Gushchin
2017-08-23 17:24 ` Johannes Weiner
2017-08-23 18:04 ` Roman Gushchin
2017-08-23 23:13 ` David Rientjes
2017-08-14 18:32 ` [v5 3/4] mm, oom: introduce oom_priority for memory cgroups Roman Gushchin
2017-08-14 22:44 ` David Rientjes
2017-08-14 18:32 ` [v5 4/4] mm, oom, docs: describe the cgroup-aware OOM killer Roman Gushchin
2017-08-14 22:52 ` David Rientjes
2017-08-15 14:13 ` Roman Gushchin
2017-08-15 20:56 ` David Rientjes
2017-08-16 14:43 ` Roman Gushchin
2017-08-17 12:16 ` Roman Gushchin
2017-08-21 0:41 ` David Rientjes
2017-08-14 22:00 ` [v5 1/4] mm, oom: refactor the oom_kill_process() function David Rientjes
2017-08-22 17:06 ` Johannes Weiner
2017-08-23 12:30 ` Roman Gushchin
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=20170815121558.GA15892@castle.dhcp.TheFacebook.com \
--to=guro@fb.com \
--cc=cgroups@vger.kernel.org \
--cc=hannes@cmpxchg.org \
--cc=kernel-team@fb.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@kernel.org \
--cc=penguin-kernel@i-love.sakura.ne.jp \
--cc=rientjes@google.com \
--cc=tj@kernel.org \
--cc=vdavydov.dev@gmail.com \
/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