Skip to content

Commit

Permalink
mm: memcontrol: reclaim at least once for __GFP_NORETRY
Browse files Browse the repository at this point in the history
Currently, __GFP_NORETRY tries charging once and gives up before even
trying to reclaim.  Bring the behavior on par with the page allocator
and reclaim at least once before giving up.

Signed-off-by: Johannes Weiner <[email protected]>
Acked-by: Michal Hocko <[email protected]>
Cc: Hugh Dickins <[email protected]>
Cc: Tejun Heo <[email protected]>
Cc: Vladimir Davydov <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
hnaz authored and torvalds committed Aug 7, 2014
1 parent 06b078f commit 28c34c2
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions mm/memcontrol.c
Original file line number Diff line number Diff line change
Expand Up @@ -2613,13 +2613,13 @@ static int mem_cgroup_try_charge(struct mem_cgroup *memcg,
if (!(gfp_mask & __GFP_WAIT))
goto nomem;

if (gfp_mask & __GFP_NORETRY)
goto nomem;

nr_reclaimed = mem_cgroup_reclaim(mem_over_limit, gfp_mask, flags);

if (mem_cgroup_margin(mem_over_limit) >= batch)
goto retry;

if (gfp_mask & __GFP_NORETRY)
goto nomem;
/*
* Even though the limit is exceeded at this point, reclaim
* may have been able to free some pages. Retry the charge
Expand Down

0 comments on commit 28c34c2

Please sign in to comment.