Thread (18 messages) 18 messages, 4 authors, 2020-11-10

Re: [PATCH v2] mm: memcg/slab: Fix return child memcg objcg for root memcg

From: Shakeel Butt <hidden>
Date: 2020-10-29 15:49:01
Also in: linux-mm, lkml

On Tue, Oct 27, 2020 at 8:50 PM Muchun Song [off-list ref] wrote:
Consider the following memcg hierarchy.

                    root
                   /    \
                  A      B

If we get the objcg of memcg A failed,
Please fix the above statement.
quoted hunk ↗ jump to hunk
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 <redacted>
---
 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?
        }
        rcu_read_unlock();

--
2.20.1
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help