From: Michal Hocko <mhocko@kernel.org>
To: Yafang Shao <laoar.shao@gmail.com>
Cc: hannes@cmpxchg.org, vdavydov.dev@gmail.com,
akpm@linux-foundation.org, linux-mm@kvack.org
Subject: Re: [PATCH 3/3] memcg oom: bail out from the charge path if no victim found
Date: Mon, 20 Apr 2020 10:13:53 +0200 [thread overview]
Message-ID: <20200420081353.GI27314@dhcp22.suse.cz> (raw)
In-Reply-To: <20200418151311.7397-4-laoar.shao@gmail.com>
On Sat 18-04-20 11:13:11, Yafang Shao wrote:
> Without considering the manually triggered OOM, if no victim found in
> system OOM, the system will be deadlocked on memory, however if no
> victim found in memcg OOM, it can charge successfully and runs well.
> This behavior in memcg oom is not proper because that can prevent the
> memcg from being limited.
>
> Take an easy example.
> $ cd /sys/fs/cgroup/foo/
> $ echo $$ > cgroup.procs
> $ echo 200M > memory.max
> $ cat memory.max
> 209715200
> $ echo -1000 > /proc/$$/oom_score_adj
> Then, let's run a memhog task in memcg foo, which will allocate 1G
> memory and keeps running.
> $ /home/yafang/test/memhog &
Well, echo -1000 is a privileged operation. And it has to be used with
an extreme care because you know that you are creating an unkillable
task. So the above test is a clear example of the misconfiguration.
> Then memory.current will be greater than memory.max. Run bellow command
> in another shell.
> $ cat /sys/fs/cgroup/foo/memory.current
> 1097228288
> The tasks which have already allocated memory and won't allocate new
> memory still runs well. This behavior makes nonsense.
>
> This patch is to improve it.
> If no victim found in memcg oom, we should force the current task to
> wait until there's available pages. That is similar with the behavior in
> memcg1 when oom_kill_disable is set.
The primary reason why we force the charge is because we _cannot_ wait
indefinitely in the charge path because the current call chain might
hold locks or other resources which could block a large part of the
system. You are essentially reintroducing that behavior.
Is the above example a real usecase or you have just tried a test case
that would trigger the problem?
--
Michal Hocko
SUSE Labs
next prev parent reply other threads:[~2020-04-20 8:13 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-18 15:13 [PATCH 0/3] memcg oom: bail out from the charge path if no victim found Yafang Shao
2020-04-18 15:13 ` [PATCH 1/3] mm: change the return type of out_of_memory() Yafang Shao
2020-04-18 15:13 ` [PATCH 2/3] mm, memcg: introduce a new helper task_in_memcg_oom_set() Yafang Shao
2020-04-18 15:13 ` [PATCH 3/3] memcg oom: bail out from the charge path if no victim found Yafang Shao
2020-04-20 8:13 ` Michal Hocko [this message]
2020-04-20 8:52 ` Yafang Shao
2020-04-20 9:14 ` Michal Hocko
2020-04-20 9:58 ` Yafang Shao
2020-04-20 10:31 ` Michal Hocko
2020-04-20 10:51 ` Yafang Shao
2020-04-20 11:10 ` Michal Hocko
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=20200420081353.GI27314@dhcp22.suse.cz \
--to=mhocko@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=hannes@cmpxchg.org \
--cc=laoar.shao@gmail.com \
--cc=linux-mm@kvack.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;
as well as URLs for NNTP newsgroup(s).