Skip to content

Commit 7feee59

Browse files
Vladimir Davydovtorvalds
authored andcommitted
memcg: disable hierarchy support if bound to the legacy cgroup hierarchy
If the memory cgroup controller is initially mounted in the scope of the default cgroup hierarchy and then remounted to a legacy hierarchy, it will still have hierarchy support enabled, which is incorrect. We should disable hierarchy support if bound to the legacy cgroup hierarchy. Signed-off-by: Vladimir Davydov <vdavydov@parallels.com> Signed-off-by: Johannes Weiner <hannes@cmpxchg.org> Acked-by: Michal Hocko <mhocko@suse.cz> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent a5a6579 commit 7feee59

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

mm/memcontrol.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5232,7 +5232,9 @@ static void mem_cgroup_bind(struct cgroup_subsys_state *root_css)
52325232
* on for the root memcg is enough.
52335233
*/
52345234
if (cgroup_on_dfl(root_css->cgroup))
5235-
mem_cgroup_from_css(root_css)->use_hierarchy = true;
5235+
root_mem_cgroup->use_hierarchy = true;
5236+
else
5237+
root_mem_cgroup->use_hierarchy = false;
52365238
}
52375239

52385240
static u64 memory_current_read(struct cgroup_subsys_state *css,

0 commit comments

Comments
 (0)