aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVladimir Davydov <vdavydov@parallels.com>2015-06-10 14:14:46 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2015-06-10 19:43:43 -0400
commit7d638093d4b0e9ef15bd78f38f11f126e773cc14 (patch)
tree1b491946b967b573c0394c58032fcc38e8aeca1d
parent85bd839983778fcd0c1c043327b14a046e979b39 (diff)
memcg: do not call reclaim if !__GFP_WAIT
When trimming memcg consumption excess (see memory.high), we call try_to_free_mem_cgroup_pages without checking if we are allowed to sleep in the current context, which can result in a deadlock. Fix this. Fixes: 241994ed8649 ("mm: memcontrol: default hierarchy interface for memory") Signed-off-by: Vladimir Davydov <vdavydov@parallels.com> Cc: Johannes Weiner <hannes@cmpxchg.org> Acked-by: Michal Hocko <mhocko@suse.cz> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--mm/memcontrol.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 14c2f2017e37..9da23a7ec4c0 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -2323,6 +2323,8 @@ done_restock:
2323 css_get_many(&memcg->css, batch); 2323 css_get_many(&memcg->css, batch);
2324 if (batch > nr_pages) 2324 if (batch > nr_pages)
2325 refill_stock(memcg, batch - nr_pages); 2325 refill_stock(memcg, batch - nr_pages);
2326 if (!(gfp_mask & __GFP_WAIT))
2327 goto done;
2326 /* 2328 /*
2327 * If the hierarchy is above the normal consumption range, 2329 * If the hierarchy is above the normal consumption range,
2328 * make the charging task trim their excess contribution. 2330 * make the charging task trim their excess contribution.