]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
mm, page_alloc: warn for non-blockable __GFP_NOFAIL allocation failure
authorDavid Rientjes <rientjes@google.com>
Fri, 3 Jan 2014 03:10:01 +0000 (14:10 +1100)
committerStephen Rothwell <sfr@canb.auug.org.au>
Fri, 3 Jan 2014 03:10:01 +0000 (14:10 +1100)
__GFP_NOFAIL may return NULL when coupled with GFP_NOWAIT or GFP_ATOMIC.

Luckily, nothing currently does such craziness.  So instead of causing
such allocations to loop (potentially forever), we maintain the current
behavior and also warn about the new users of the deprecated flag.

Suggested-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: David Rientjes <rientjes@google.com>
Cc: Mel Gorman <mgorman@suse.de>
Cc: Michal Hocko <mhocko@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/page_alloc.c

index 6c5834377bcc4b1c89a25e65676d76c2dac43774..4cda8b9efa4395eed45636cbed75a61b0acd24f7 100644 (file)
@@ -2525,8 +2525,15 @@ rebalance:
        }
 
        /* Atomic allocations - we can't balance anything */
-       if (!wait)
+       if (!wait) {
+               /*
+                * All existing users of the deprecated __GFP_NOFAIL are
+                * blockable, so warn of any new users that actually allow this
+                * type of allocation to fail.
+                */
+               WARN_ON_ONCE(gfp_mask & __GFP_NOFAIL);
                goto nopage;
+       }
 
        /* Avoid recursion of direct reclaim */
        if (current->flags & PF_MEMALLOC)