Skip to content

Commit 0dcf19b

Browse files
avagingregkh
authored andcommitted
memcg: don't initialize kmem-cache destroying work for root caches
commit 3e6b11d upstream. struct memcg_cache_params has a union. Different parts of this union are used for root and non-root caches. A part with destroying work is used only for non-root caches. I fixed the same problem in another place v3.9-rc1-16204-gf101a94, but didn't notice this one. This patch fixes the kernel panic: [ 46.848187] BUG: unable to handle kernel paging request at 000000fffffffeb8 [ 46.849026] IP: [<ffffffff811a484c>] kmem_cache_destroy_memcg_children+0x6c/0xc0 [ 46.849092] PGD 0 [ 46.849092] Oops: 0000 [#1] SMP ... Signed-off-by: Andrey Vagin <[email protected]> Cc: Glauber Costa <[email protected]> Cc: Johannes Weiner <[email protected]> Acked-by: Michal Hocko <[email protected]> Cc: Balbir Singh <[email protected]> Cc: KAMEZAWA Hiroyuki <[email protected]> Cc: Konstantin Khlebnikov <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent b6664df commit 0dcf19b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

mm/memcontrol.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3186,11 +3186,11 @@ int memcg_register_cache(struct mem_cgroup *memcg, struct kmem_cache *s,
31863186
if (!s->memcg_params)
31873187
return -ENOMEM;
31883188

3189-
INIT_WORK(&s->memcg_params->destroy,
3190-
kmem_cache_destroy_work_func);
31913189
if (memcg) {
31923190
s->memcg_params->memcg = memcg;
31933191
s->memcg_params->root_cache = root_cache;
3192+
INIT_WORK(&s->memcg_params->destroy,
3193+
kmem_cache_destroy_work_func);
31943194
} else
31953195
s->memcg_params->is_root_cache = true;
31963196

0 commit comments

Comments
 (0)