All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michal Hocko <mhocko@suse.com>
To: Muchun Song <songmuchun@bytedance.com>
Cc: Roman Gushchin <guro@fb.com>,
	Johannes Weiner <hannes@cmpxchg.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Shakeel Butt <shakeelb@google.com>,
	Vladimir Davydov <vdavydov.dev@gmail.com>,
	LKML <linux-kernel@vger.kernel.org>,
	Linux Memory Management List <linux-mm@kvack.org>
Subject: Re: [External] Re: [PATCH] mm: memcontrol: fix memsw uncharge for root_mem_cgroup
Date: Wed, 24 Mar 2021 10:20:25 +0100	[thread overview]
Message-ID: <YFsEWfzxB3iPc66Y@dhcp22.suse.cz> (raw)
In-Reply-To: <CAMZfGtVe6seRLA7Wo4TST0ApkaHdkDmv6sL5GZytK_4hvMbkXg@mail.gmail.com>

On Wed 24-03-21 16:50:41, Muchun Song wrote:
> On Wed, Mar 24, 2021 at 4:33 PM Michal Hocko <mhocko@suse.com> wrote:
> >
> > On Wed 24-03-21 12:11:35, Muchun Song wrote:
> > > On Tue, Mar 23, 2021 at 11:04 PM Muchun Song <songmuchun@bytedance.com> wrote:
> > > >
> > > > The pages aren't accounted at the root level, so we cannot uncharge the
> > > > page to the memsw counter for the root memcg. Fix this.
> > > >
> > > > Fixes: 1f47b61fb407 ("mm: memcontrol: fix swap counter leak on swapout from offline cgroup")
> > > > Signed-off-by: Muchun Song <songmuchun@bytedance.com>
> > >
> > > I am very sorry. I should repent. I suddenly realise the fix is totally
> > > wrong. Because the @memcg cannot be root memcg when
> > > @memcg != @swap_memcg.
> >
> > I am probably blind but I do not see why this would be the case.
> > We have memcg != swap_memcg in this branch but we do not know the
> > neither of the two is root_mem_cgroup, no? If we did knot that we
> > wouldn't have to check for swap_memcg != root_mem_cgroup. Or do I miss
> > something?
> 
> I look at the mem_cgroup_id_get_online() closely. If memcg is root, this
> function always returns root memcg. So memcg will equal swap_memcg.

Ahh, I can see it now. I have completely missed that the swap_memcg is
a parent of an offline memcg. I should have looked more closely.
-- 
Michal Hocko
SUSE Labs

      reply	other threads:[~2021-03-24  9:21 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-23 14:56 [PATCH] mm: memcontrol: fix memsw uncharge for root_mem_cgroup Muchun Song
2021-03-23 16:11 ` Michal Hocko
2021-03-24  4:11 ` Muchun Song
2021-03-24  4:11   ` Muchun Song
2021-03-24  8:33   ` Michal Hocko
2021-03-24  8:50     ` [External] " Muchun Song
2021-03-24  8:50       ` Muchun Song
2021-03-24  9:20       ` Michal Hocko [this message]

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=YFsEWfzxB3iPc66Y@dhcp22.suse.cz \
    --to=mhocko@suse.com \
    --cc=akpm@linux-foundation.org \
    --cc=guro@fb.com \
    --cc=hannes@cmpxchg.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=shakeelb@google.com \
    --cc=songmuchun@bytedance.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.