linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Roman Gushchin <guro@fb.com>
To: Shakeel Butt <shakeelb@google.com>
Cc: Muchun Song <songmuchun@bytedance.com>,
	Johannes Weiner <hannes@cmpxchg.org>,
	Michal Hocko <mhocko@kernel.org>,
	Vladimir Davydov <vdavydov.dev@gmail.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Joonsoo Kim <iamjoonsoo.kim@lge.com>,
	Yafang Shao <laoar.shao@gmail.com>,
	Chris Down <chris@chrisdown.name>,
	Christian Brauner <christian.brauner@ubuntu.com>,
	"Peter Zijlstra (Intel)" <peterz@infradead.org>,
	Ingo Molnar <mingo@kernel.org>, Kees Cook <keescook@chromium.org>,
	Thomas Gleixner <tglx@linutronix.de>, <esyr@redhat.com>,
	Suren Baghdasaryan <surenb@google.com>, <areber@redhat.com>,
	Marco Elver <elver@google.com>,
	LKML <linux-kernel@vger.kernel.org>,
	Cgroups <cgroups@vger.kernel.org>, Linux MM <linux-mm@kvack.org>
Subject: Re: [PATCH v2] mm: memcg/slab: Fix return child memcg objcg for root memcg
Date: Thu, 29 Oct 2020 10:09:55 -0700	[thread overview]
Message-ID: <20201029170955.GI827280@carbon.dhcp.thefacebook.com> (raw)
In-Reply-To: <CALvZod6p_y2fTEK5fzAL=JfPsguqYbttgWC4_GPc=rF1PsN6TQ@mail.gmail.com>

On Thu, Oct 29, 2020 at 08:48:45AM -0700, Shakeel Butt wrote:
> On Tue, Oct 27, 2020 at 8:50 PM Muchun Song <songmuchun@bytedance.com> wrote:
> >
> > Consider the following memcg hierarchy.
> >
> >                     root
> >                    /    \
> >                   A      B
> >
> > If we get the objcg of memcg A failed,
> 
> Please fix the above statement.
> 
> > the get_obj_cgroup_from_current
> > can return the wrong objcg for the root memcg.
> >
> > Fixes: bf4f059954dc ("mm: memcg/slab: obj_cgroup API")
> > Signed-off-by: Muchun Song <songmuchun@bytedance.com>
> > ---
> >  changelog in v2:
> >  1. Do not use a comparison with the root_mem_cgroup
> >
> >  mm/memcontrol.c | 1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> > index 1337775b04f3..8c8b4c3ed5a0 100644
> > --- a/mm/memcontrol.c
> > +++ b/mm/memcontrol.c
> > @@ -2961,6 +2961,7 @@ __always_inline struct obj_cgroup *get_obj_cgroup_from_current(void)
> >                 objcg = rcu_dereference(memcg->objcg);
> >                 if (objcg && obj_cgroup_tryget(objcg))
> >                         break;
> > +               objcg = NULL;
> 
> Roman, in your cleanup, are you planning to have objcg for root memcg as well?

Yes. I'll just change the for loop to include the root_mem_cgroup.

Thanks!

  parent reply	other threads:[~2020-10-29 17:10 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-28  3:50 [PATCH v2] mm: memcg/slab: Fix return child memcg objcg for root memcg Muchun Song
2020-10-28  3:50 ` [PATCH v2] mm: memcg/slab: Fix use after free in obj_cgroup_charge Muchun Song
2020-10-29 15:52   ` Shakeel Butt
2020-11-10  3:19   ` Muchun Song
2020-10-28  3:50 ` [PATCH v2] mm: memcg/slab: Rename *_lruvec_slab_state to *_lruvec_kmem_state Muchun Song
2020-10-29 15:52   ` Shakeel Butt
2020-10-28  3:50 ` [PATCH v2] mm: memcontrol: Simplify the mem_cgroup_page_lruvec Muchun Song
2020-10-29  9:08   ` Michal Hocko
2020-10-29 16:01     ` Shakeel Butt
2020-10-29 16:13       ` Michal Hocko
2020-10-29  0:16 ` [PATCH v2] mm: memcg/slab: Fix return child memcg objcg for root memcg Roman Gushchin
2020-10-29 15:48 ` Shakeel Butt
2020-10-29 16:08   ` [External] " Muchun Song
2020-10-29 16:18     ` Shakeel Butt
2020-10-29 16:32       ` Muchun Song
2020-10-29 17:09   ` Roman Gushchin [this message]
2020-10-29 20:34     ` Shakeel Butt
2020-10-29 21:25       ` 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=20201029170955.GI827280@carbon.dhcp.thefacebook.com \
    --to=guro@fb.com \
    --cc=akpm@linux-foundation.org \
    --cc=areber@redhat.com \
    --cc=cgroups@vger.kernel.org \
    --cc=chris@chrisdown.name \
    --cc=christian.brauner@ubuntu.com \
    --cc=elver@google.com \
    --cc=esyr@redhat.com \
    --cc=hannes@cmpxchg.org \
    --cc=iamjoonsoo.kim@lge.com \
    --cc=keescook@chromium.org \
    --cc=laoar.shao@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@kernel.org \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=shakeelb@google.com \
    --cc=songmuchun@bytedance.com \
    --cc=surenb@google.com \
    --cc=tglx@linutronix.de \
    --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).