mirror of
https://github.com/torvalds/linux
synced 2024-11-05 18:23:50 +00:00
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: 241994ed86
("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>
This commit is contained in:
parent
85bd839983
commit
7d638093d4
1 changed files with 2 additions and 0 deletions
|
@ -2323,6 +2323,8 @@ static int try_charge(struct mem_cgroup *memcg, gfp_t gfp_mask,
|
|||
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.
|
||||
|
|
Loading…
Reference in a new issue