From: Hugh Dickins Date: Thu, 14 Jan 2016 23:21:37 +0000 (-0800) Subject: memcg: avoid vmpressure oops when memcg disabled X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=686739f6af5e8d5687ffebbf1193ff066aada6d9;p=openwrt%2Fstaging%2Fblogic.git memcg: avoid vmpressure oops when memcg disabled A CONFIG_MEMCG=y kernel booted with "cgroup_disable=memory" crashes on a NULL memcg (but non-NULL root_mem_cgroup) when vmpressure kicks in. Here's the patch I use to avoid that, but you might prefer a test on mem_cgroup_disabled() somewhere. Signed-off-by: Hugh Dickins Acked-by: Johannes Weiner Cc: David S. Miller Cc: Vladimir Davydov Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/mm/vmpressure.c b/mm/vmpressure.c index 506f03e4be47..9a6c0704211c 100644 --- a/mm/vmpressure.c +++ b/mm/vmpressure.c @@ -260,7 +260,7 @@ void vmpressure(gfp_t gfp, struct mem_cgroup *memcg, bool tree, enum vmpressure_levels level; /* For now, no users for root-level efficiency */ - if (memcg == root_mem_cgroup) + if (!memcg || memcg == root_mem_cgroup) return; spin_lock(&vmpr->sr_lock);