linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] mm/memcg: mem_cgroup_per_node is already set to 0 on allocation
@ 2022-02-01  0:46 Wei Yang
  2022-02-01  0:46 ` [PATCH 2/2] mm/memcg: retrieve parent memcg from css.parent Wei Yang
  0 siblings, 1 reply; 2+ messages in thread
From: Wei Yang @ 2022-02-01  0:46 UTC (permalink / raw)
  To: hannes, mhocko, vdavydov.dev, akpm, shakeelb, guro, willy,
	songmuchun, shy828301, surenb
  Cc: linux-kernel, cgroups, linux-mm, vbabka, Wei Yang

kzalloc_node() would set data to 0, so it's not necessary to set it
again.

Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
Reviewed-by: Muchun Song <songmuchun@bytedance.com>
Acked-by: Michal Hocko <mhocko@suse.com>
Reviewed-by: Roman Gushchin <guro@fb.com>
Reviewed-by: Mike Rapoport <rppt@linux.ibm.com>
Reviewed-by: Shakeel Butt <shakeelb@google.com>
---
 mm/memcontrol.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index ea8460658550..ce7060907df2 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -5070,8 +5070,6 @@ static int alloc_mem_cgroup_per_node_info(struct mem_cgroup *memcg, int node)
 	}
 
 	lruvec_init(&pn->lruvec);
-	pn->usage_in_excess = 0;
-	pn->on_tree = false;
 	pn->memcg = memcg;
 
 	memcg->nodeinfo[node] = pn;
-- 
2.33.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [PATCH 2/2] mm/memcg: retrieve parent memcg from css.parent
  2022-02-01  0:46 [PATCH 1/2] mm/memcg: mem_cgroup_per_node is already set to 0 on allocation Wei Yang
@ 2022-02-01  0:46 ` Wei Yang
  0 siblings, 0 replies; 2+ messages in thread
From: Wei Yang @ 2022-02-01  0:46 UTC (permalink / raw)
  To: hannes, mhocko, vdavydov.dev, akpm, shakeelb, guro, willy,
	songmuchun, shy828301, surenb
  Cc: linux-kernel, cgroups, linux-mm, vbabka, Wei Yang

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>
Reviewed-by: Muchun Song <songmuchun@bytedance.com>
Acked-by: Michal Hocko <mhocko@suse.com>
Reviewed-by: Roman Gushchin <guro@fb.com>
Reviewed-by: Shakeel Butt <shakeelb@google.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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-02-01  0:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-01  0:46 [PATCH 1/2] mm/memcg: mem_cgroup_per_node is already set to 0 on allocation Wei Yang
2022-02-01  0:46 ` [PATCH 2/2] mm/memcg: retrieve parent memcg from css.parent Wei Yang

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).