From: Johannes Weiner Date: Thu, 26 Jun 2014 00:42:36 +0000 (+1000) Subject: mm: memcontrol: reclaim at least once for __GFP_NORETRY X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=375e7d44c9d65f6351e654f0aa3adc7f6aba703b;p=karo-tx-linux.git mm: memcontrol: reclaim at least once for __GFP_NORETRY 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 Acked-by: Michal Hocko Cc: Hugh Dickins Cc: Tejun Heo Cc: Vladimir Davydov Signed-off-by: Andrew Morton --- diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 9a52395d05cf..f4d34a9f1bae 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -2613,13 +2613,13 @@ retry: 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