From: Yafang Shao <laoar.shao@gmail.com>
To: Michal Hocko <mhocko@kernel.org>
Cc: Roman Gushchin <guro@fb.com>, Chris Down <chris@chrisdown.name>,
Andrew Morton <akpm@linux-foundation.org>,
Vladimir Davydov <vdavydov.dev@gmail.com>,
Linux MM <linux-mm@kvack.org>,
stable@vger.kernel.org, Johannes Weiner <hannes@cmpxchg.org>
Subject: Re: [PATCH] mm, memcg: fix wrong mem cgroup protection
Date: Fri, 24 Apr 2020 18:57:10 +0800 [thread overview]
Message-ID: <CALOAHbC8U+SyauQPraUbEf2=Wx1bBtKZKU4N9iscUV+distEkA@mail.gmail.com> (raw)
In-Reply-To: <20200424104041.GE11591@dhcp22.suse.cz>
On Fri, Apr 24, 2020 at 6:40 PM Michal Hocko <mhocko@kernel.org> wrote:
>
> On Thu 23-04-20 14:13:19, Roman Gushchin wrote:
> > On Thu, Apr 23, 2020 at 04:33:23PM +0100, Chris Down wrote:
> > > Hi Yafang,
> > >
> > > I'm afraid I'm just as confused as Michal was about the intent of this patch.
> > >
> > > Can you please be more concise and clear about the practical ramifications
> > > and demonstrate some pathological behaviour? I really can't visualise what's
> > > wrong here from your explanation, and if I can't understand it as the person
> > > who wrote this code, I am not surprised others are also confused :-)
> > >
> > > Or maybe Roman can try to explain, since he acked the previous patch? At
> > > least to me, the emin/elow behaviour seems fairly non-trivial to reason
> > > about right now.
> >
> > Hi Chris!
> >
> > So the thing is that emin/elow cached values are shared between global and
> > targeted (caused by memory.max) reclaim. It's racy by design, but in general
> > it should work ok, because in the end we'll reclaim or not approximately
> > the same amount of memory.
> >
> > In the case which Yafang described, the emin value calculated in the process
> > of the global reclaim leads to a slowdown of the targeted reclaim. It's not
> > a tragedy, but not perfect too. It seems that the proposed patch makes it better,
> > and as now I don't see any bad consequences.
>
> Do we have any means to quantify the effect?
>
> I do understand the racy nature of the effective protection values. We
> do update them in mem_cgroup_protected and that handles the
> reclaim_target == memcg case already. So why do we care later on in
> mem_cgroup_protection? And why don't we care about any other concurrent
> reclaimers which have a different reclaim memcg target? This just
> doesn't make any sense.
>
No, you missed the point.
The issue pointed by me isn't related with racy. Roman also explained
that the racy is not the point.
> Either we do care about races because they are harmful and then we care
> for all possible case or we don't and this patch doesn't really any big
> value. Or I still miss the point.
>
The real point is memcg relcaim will get a wrong value from
mem_cgroup_protection() after memory.emin is set.
Suppose target memcg has memory.current is 2G and memory.min is 2G, in
memcg reclaim, the scan count will be
(SWAP_CLUSTER_MAX>>sc->priority), rather than (lruvec_size >>
sc->priority). That's a slowdown, and that's explained by Roman as
well.
--
Thanks
Yafang
next prev parent reply other threads:[~2020-04-24 10:57 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-23 6:16 [PATCH] mm, memcg: fix wrong mem cgroup protection Yafang Shao
2020-04-23 15:33 ` Chris Down
2020-04-23 21:13 ` Roman Gushchin
2020-04-24 0:32 ` Yafang Shao
2020-04-24 10:40 ` Michal Hocko
2020-04-24 10:57 ` Yafang Shao [this message]
2020-04-24 0:49 ` Yafang Shao
2020-04-24 12:18 ` Chris Down
2020-04-24 12:44 ` Yafang Shao
2020-04-24 13:05 ` Chris Down
2020-04-24 13:10 ` Yafang Shao
2020-04-23 21:06 ` Roman Gushchin
2020-04-24 0:29 ` Yafang Shao
2020-04-24 13:14 ` Johannes Weiner
2020-04-24 13:44 ` Johannes Weiner
2020-04-24 14:33 ` Michal Hocko
2020-04-24 16:08 ` Yafang Shao
2020-04-24 14:29 ` Michal Hocko
2020-04-24 15:10 ` Johannes Weiner
2020-04-24 16:21 ` Michal Hocko
2020-04-24 16:51 ` Johannes Weiner
2020-04-27 8:25 ` Michal Hocko
2020-04-27 8:37 ` Yafang Shao
2020-04-27 16:52 ` Johannes Weiner
2020-04-24 16:21 ` Roman Gushchin
2020-04-24 16:30 ` Yafang Shao
2020-04-24 16:00 ` Yafang Shao
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='CALOAHbC8U+SyauQPraUbEf2=Wx1bBtKZKU4N9iscUV+distEkA@mail.gmail.com' \
--to=laoar.shao@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=chris@chrisdown.name \
--cc=guro@fb.com \
--cc=hannes@cmpxchg.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@kernel.org \
--cc=stable@vger.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;
as well as URLs for NNTP newsgroup(s).