[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20220201004643.8391-2-richard.weiyang@gmail.com>
Date: Tue, 1 Feb 2022 00:46:43 +0000
From: Wei Yang <richard.weiyang@...il.com>
To: hannes@...xchg.org, mhocko@...nel.org, vdavydov.dev@...il.com,
akpm@...ux-foundation.org, shakeelb@...gle.com, guro@...com,
willy@...radead.org, songmuchun@...edance.com, shy828301@...il.com,
surenb@...gle.com
Cc: linux-kernel@...r.kernel.org, cgroups@...r.kernel.org,
linux-mm@...ck.org, vbabka@...e.cz,
Wei Yang <richard.weiyang@...il.com>
Subject: [PATCH 2/2] mm/memcg: retrieve parent memcg from css.parent
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@...il.com>
Reviewed-by: Muchun Song <songmuchun@...edance.com>
Acked-by: Michal Hocko <mhocko@...e.com>
Reviewed-by: Roman Gushchin <guro@...com>
Reviewed-by: Shakeel Butt <shakeelb@...gle.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
Powered by blists - more mailing lists