[Devel] [PATCH RH7 1/2] mm/memcontrol.c: lost css_put in memcg_expand_shrinker_maps()

Vasily Averin vvs at virtuozzo.com
Wed Feb 12 09:16:01 MSK 2020


for_each_mem_cgroup() increases css reference counter for memory cgroup
and requires to use mem_cgroup_iter_break() if the walk is cancelled.

Link: http://lkml.kernel.org/r/c98414fb-7e1f-da0f-867a-9340ec4bd30b@virtuozzo.com
Fixes: 0a4465d34028 ("mm, memcg: assign memcg-aware shrinkers bitmap to memcg")
Signed-off-by: Vasily Averin <vvs at virtuozzo.com>
Acked-by: Kirill Tkhai <ktkhai at virtuozzo.com>
Acked-by: Michal Hocko <mhocko at suse.com>
Reviewed-by: Roman Gushchin <guro at fb.com>
Signed-off-by: Andrew Morton <akpm at linux-foundation.org>
---
 mm/memcontrol.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 2f988271d111..2054e7bfb73d 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -822,8 +822,10 @@ int memcg_expand_shrinker_maps(int new_id)
 		if (mem_cgroup_is_root(memcg))
 			continue;
 		ret = memcg_expand_one_shrinker_map(memcg, size, old_size);
-		if (ret)
+		if (ret) {
+			mem_cgroup_iter_break(NULL, memcg);
 			goto unlock;
+		}
 	}
 unlock:
 	if (!ret)
-- 
2.17.1



More information about the Devel mailing list