]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
mm: memcontrol: reclaim at least once for __GFP_NORETRY
authorJohannes Weiner <hannes@cmpxchg.org>
Thu, 26 Jun 2014 00:42:36 +0000 (10:42 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Thu, 26 Jun 2014 00:42:36 +0000 (10:42 +1000)
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 <hannes@cmpxchg.org>
Acked-by: Michal Hocko <mhocko@suse.cz>
Cc: Hugh Dickins <hughd@google.com>
Cc: Tejun Heo <tj@kernel.org>
Cc: Vladimir Davydov <vdavydov@parallels.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/memcontrol.c

index 9a52395d05cfe450cb4ad42c76af88a9aaca1e7f..f4d34a9f1bae3dd50dec4de8a306c21bf4dd4061 100644 (file)
@@ -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