From 520bea647f250c76adb24f09d30d8d2959c3bc19 Mon Sep 17 00:00:00 2001 From: Roman Gushchin Date: Sat, 10 Oct 2020 15:39:59 +0800 Subject: [PATCH] mm: memcg/slab: don't check the dying flag on kmem_cache creation mainline inclusion from mainline-5.3-rc1 commit 570332978ea7fdbec86a07086a584d796a87da2c category: bugfix bugzilla: 34611 CVE: NA ------------------------------------------------- There is no point in checking the root_cache->memcg_params.dying flag on kmem_cache creation path. New allocations shouldn't be performed using a dead root kmem_cache, so no new memcg kmem_cache creation can be scheduled after the flag is set. And if it was scheduled before, flush_memcg_workqueue() will wait for it anyway. So let's drop this check to simplify the code. Link: http://lkml.kernel.org/r/20190611231813.3148843-7-guro@fb.com Signed-off-by: Roman Gushchin Acked-by: Vladimir Davydov Reviewed-by: Shakeel Butt Cc: Christoph Lameter Cc: Johannes Weiner Cc: Michal Hocko Cc: Waiman Long Cc: David Rientjes Cc: Joonsoo Kim Cc: Pekka Enberg Cc: Andrei Vagin Cc: Qian Cai Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds (cherry picked from commit 570332978ea7fdbec86a07086a584d796a87da2c) Signed-off-by: Kefeng Wang Signed-off-by: Liu Shixin Reviewed-by: Kefeng Wang Signed-off-by: Yang Yingliang --- mm/slab_common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/slab_common.c b/mm/slab_common.c index 318d2527bc0b..9e2111ae8e16 100644 --- a/mm/slab_common.c +++ b/mm/slab_common.c @@ -622,7 +622,7 @@ void memcg_create_kmem_cache(struct mem_cgroup *memcg, * The memory cgroup could have been offlined while the cache * creation work was pending. */ - if (memcg->kmem_state != KMEM_ONLINE || root_cache->memcg_params.dying) + if (memcg->kmem_state != KMEM_ONLINE) goto out_unlock; idx = memcg_cache_id(memcg); -- GitLab