aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Rientjes <rientjes@google.com>2014-01-21 18:51:12 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2014-01-21 19:19:49 -0500
commitaed0a0e32de387da831284fda25021de32477195 (patch)
tree503af52f3d2d7ae2d3cdccb648fcd7977658f9ea
parent55b7c4c99f6a448f72179297fe6432544f220063 (diff)
mm, page_alloc: warn for non-blockable __GFP_NOFAIL allocation failure
__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> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--mm/page_alloc.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 84da0e3bc886..533e2147d14f 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -2525,8 +2525,15 @@ rebalance:
2525 } 2525 }
2526 2526
2527 /* Atomic allocations - we can't balance anything */ 2527 /* Atomic allocations - we can't balance anything */
2528 if (!wait) 2528 if (!wait) {
2529 /*
2530 * All existing users of the deprecated __GFP_NOFAIL are
2531 * blockable, so warn of any new users that actually allow this
2532 * type of allocation to fail.
2533 */
2534 WARN_ON_ONCE(gfp_mask & __GFP_NOFAIL);
2529 goto nopage; 2535 goto nopage;
2536 }
2530 2537
2531 /* Avoid recursion of direct reclaim */ 2538 /* Avoid recursion of direct reclaim */
2532 if (current->flags & PF_MEMALLOC) 2539 if (current->flags & PF_MEMALLOC)