cgroups.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michal Hocko <mhocko@suse.com>
To: Wei Yang <richard.weiyang@gmail.com>
Cc: hannes@cmpxchg.org, vdavydov.dev@gmail.com,
	akpm@linux-foundation.org, shakeelb@google.com, guro@fb.com,
	vbabka@suse.cz, willy@infradead.org, songmuchun@bytedance.com,
	shy828301@gmail.com, surenb@google.com,
	linux-kernel@vger.kernel.org, cgroups@vger.kernel.org,
	linux-mm@kvack.org
Subject: Re: [PATCH 3/4] mm/memcg: retrieve parent memcg from css.parent
Date: Tue, 11 Jan 2022 09:43:07 +0100	[thread overview]
Message-ID: <Yd1DG99LPXDmDvvs@dhcp22.suse.cz> (raw)
In-Reply-To: <20220111010302.8864-3-richard.weiyang@gmail.com>

On Tue 11-01-22 01:03:01, Wei Yang wrote:
> The parent we get from page_counter is correct, while this is two
> different hierarchy.
> 
> Let's retrieve the parent memcg from css.parent just like parent_cs(),
> blkcg_parent(), etc.
> 
> Signed-off-by: Wei Yang <richard.weiyang@gmail.com>

Acked-by: Michal Hocko <mhocko@suse.com>

> ---
>  include/linux/memcontrol.h | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
> index 0c5c403f4be6..12bf443f7b14 100644
> --- a/include/linux/memcontrol.h
> +++ b/include/linux/memcontrol.h
> @@ -886,9 +886,7 @@ static inline struct mem_cgroup *lruvec_memcg(struct lruvec *lruvec)
>   */
>  static inline struct mem_cgroup *parent_mem_cgroup(struct mem_cgroup *memcg)
>  {
> -	if (!memcg->memory.parent)
> -		return NULL;
> -	return mem_cgroup_from_counter(memcg->memory.parent, memory);
> +	return mem_cgroup_from_css(memcg->css.parent);
>  }
>  
>  static inline bool mem_cgroup_is_descendant(struct mem_cgroup *memcg,
> -- 
> 2.33.1

-- 
Michal Hocko
SUSE Labs

  reply	other threads:[~2022-01-11  8:43 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-11  1:02 [PATCH 1/4] mm/memcg: use NUMA_NO_NODE to indicate allocation from unspecified node Wei Yang
2022-01-11  1:03 ` [PATCH 2/4] mm/memcg: mem_cgroup_per_node is already set to 0 on allocation Wei Yang
2022-01-11  8:41   ` Michal Hocko
2022-01-14 11:08   ` Mike Rapoport
     [not found]   ` <20220111010302.8864-2-richard.weiyang-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2022-01-11  2:25     ` Muchun Song
2022-01-11 18:06     ` Roman Gushchin
2022-01-16 19:24     ` Shakeel Butt
     [not found] ` <20220111010302.8864-1-richard.weiyang-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2022-01-11  1:03   ` [PATCH 3/4] mm/memcg: retrieve parent memcg from css.parent Wei Yang
2022-01-11  8:43     ` Michal Hocko [this message]
     [not found]     ` <20220111010302.8864-3-richard.weiyang-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2022-01-11  3:12       ` Muchun Song
2022-01-11 18:09       ` Roman Gushchin
     [not found]         ` <Yd3H8Hea6dBlkzeW-cx5fftMpWqeCjSd+JxjunQ2O0Ztt9esIQQ4Iyu8u01E@public.gmane.org>
2022-01-12  0:24           ` Wei Yang
2022-01-16 19:54       ` Shakeel Butt
2022-01-11  1:03   ` [PATCH 4/4] mm/memcg: refine mem_cgroup_threshold_ary->current_threshold calculation Wei Yang
2022-01-11  8:44     ` Michal Hocko
     [not found]     ` <20220111010302.8864-4-richard.weiyang-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2022-01-11 18:23       ` Roman Gushchin
     [not found]         ` <Yd3LLalWzPy17PmR-cx5fftMpWqeCjSd+JxjunQ2O0Ztt9esIQQ4Iyu8u01E@public.gmane.org>
2022-01-12  0:25           ` Wei Yang
2022-01-11  2:23   ` [PATCH 1/4] mm/memcg: use NUMA_NO_NODE to indicate allocation from unspecified node Muchun Song
2022-01-11  8:40   ` Michal Hocko
     [not found]     ` <Yd1CdJA5NelzoK1D-2MMpYkNvuYDjFM9bn6wA6Q@public.gmane.org>
2022-01-12  0:46       ` Wei Yang
2022-01-12  8:56         ` Michal Hocko
     [not found]           ` <Yd6Xr7K9bKGVgGtI-2MMpYkNvuYDjFM9bn6wA6Q@public.gmane.org>
2022-01-14  0:29             ` Wei Yang
2022-01-14  8:51               ` Michal Hocko
     [not found]                 ` <YeE5k79uP3xBPCv7-2MMpYkNvuYDjFM9bn6wA6Q@public.gmane.org>
2022-01-15 22:10                   ` Wei Yang
2022-01-16 19:23             ` Shakeel Butt
2022-01-11 18:05   ` Roman Gushchin
2022-01-14 11:07   ` Mike Rapoport
2022-01-31  1:47 ` Wei Yang
2022-01-31 22:36   ` Andrew Morton
     [not found]     ` <20220131143620.b619f24f5246b26bce2b717d-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>
2022-02-01  0:42       ` Wei Yang

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=Yd1DG99LPXDmDvvs@dhcp22.suse.cz \
    --to=mhocko@suse.com \
    --cc=akpm@linux-foundation.org \
    --cc=cgroups@vger.kernel.org \
    --cc=guro@fb.com \
    --cc=hannes@cmpxchg.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=richard.weiyang@gmail.com \
    --cc=shakeelb@google.com \
    --cc=shy828301@gmail.com \
    --cc=songmuchun@bytedance.com \
    --cc=surenb@google.com \
    --cc=vbabka@suse.cz \
    --cc=vdavydov.dev@gmail.com \
    --cc=willy@infradead.org \
    /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).