Commit 7d638093 authored by Vladimir Davydov's avatar Vladimir Davydov Committed by Linus Torvalds
Browse files

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: 241994ed ("mm: memcontrol: default hierarchy interface for memory")
Signed-off-by: default avatarVladimir Davydov <vdavydov@parallels.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Acked-by: default avatarMichal Hocko <mhocko@suse.cz>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 85bd8399
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -2323,6 +2323,8 @@ done_restock:
	css_get_many(&memcg->css, batch);
	if (batch > nr_pages)
		refill_stock(memcg, batch - nr_pages);
	if (!(gfp_mask & __GFP_WAIT))
		goto done;
	/*
	 * If the hierarchy is above the normal consumption range,
	 * make the charging task trim their excess contribution.