Commit aed0a0e3 authored by David Rientjes's avatar David Rientjes Committed by Linus Torvalds

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: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarDavid Rientjes <rientjes@google.com>
Cc: Mel Gorman <mgorman@suse.de>
Cc: Michal Hocko <mhocko@suse.cz>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 55b7c4c9
...@@ -2525,8 +2525,15 @@ __alloc_pages_slowpath(gfp_t gfp_mask, unsigned int order, ...@@ -2525,8 +2525,15 @@ __alloc_pages_slowpath(gfp_t gfp_mask, unsigned int order,
} }
/* Atomic allocations - we can't balance anything */ /* 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; goto nopage;
}
/* Avoid recursion of direct reclaim */ /* Avoid recursion of direct reclaim */
if (current->flags & PF_MEMALLOC) if (current->flags & PF_MEMALLOC)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment