This helper uses static key and is claimed "fast" test for default
hierarchy, so let's use it everywhere.

Fixes: 16086c4ea5a33 ("mm/memcontrol: fix mem_cgroup_enough_memory on 
cgroup-v2")
https://virtuozzo.atlassian.net/browse/VSTOR-105819
Signed-off-by: Pavel Tikhomirov <[email protected]>

Feature: mm: per-CT memory overcommit heuristic
---
 mm/memcontrol.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 326f92657c2d3..cba985e5d3d1d 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -3391,7 +3391,7 @@ static int mem_cgroup_enough_memory(struct mem_cgroup 
*memcg, long pages)
        long free;
 
        /* unused memory */
-       if (memcg->css.cgroup->root == &cgrp_dfl_root) {
+       if (cgroup_subsys_on_dfl(memory_cgrp_subsys)) {
                free = memcg->memory.max - page_counter_read(&memcg->memory);
                free += memcg->swap.max - page_counter_read(&memcg->swap);
        } else {
-- 
2.51.0

_______________________________________________
Devel mailing list
[email protected]
https://lists.openvz.org/mailman/listinfo/devel

Reply via email to