Skip to content

Commit

Permalink
memcg: avoid vmpressure oops when memcg disabled
Browse files Browse the repository at this point in the history
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 <[email protected]>
Acked-by: Johannes Weiner <[email protected]>
Cc: David S. Miller <[email protected]>
Cc: Vladimir Davydov <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Hugh Dickins authored and torvalds committed Jan 15, 2016
1 parent ef12947 commit 686739f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion mm/vmpressure.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 686739f

Please sign in to comment.