diff --git a/mm/memcontrol.c b/mm/memcontrol.c index f7b6bec9f538..a73f3947f5d9 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -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