mirror of
https://github.com/torvalds/linux.git
synced 2026-10-07 05:31:08 -04:00
oom: invoke oom killer for __GFP_NOFAIL
The oom killer must be invoked regardless of the order if the allocation is __GFP_NOFAIL, otherwise it will loop forever when reclaim fails to free some memory. Cc: Nick Piggin <[email protected]> Acked-by: Rik van Riel <[email protected]> Acked-by: Mel Gorman <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Christoph Lameter <[email protected]> Cc: Dave Hansen <[email protected]> Signed-off-by: David Rientjes <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
1 parent
4d8b9135c3
commit
82553a937f
1 file changed
+7
-5
+7
-5
@@ -1561,7 +1561,7 @@ __alloc_pages_may_oom(gfp_t gfp_mask, unsigned int order,
|
||||
goto out;
|
||||
|
||||
/* The OOM killer will not help higher order allocs */
|
||||
if (order > PAGE_ALLOC_COSTLY_ORDER)
|
||||
if (order > PAGE_ALLOC_COSTLY_ORDER && !(gfp_mask & __GFP_NOFAIL))
|
||||
goto out;
|
||||
|
||||
/* Exhausted what can be done so it's blamo time */
|
||||
@@ -1781,11 +1781,13 @@ rebalance:
|
||||
goto got_pg;
|
||||
|
||||
/*
|
||||
* The OOM killer does not trigger for high-order allocations
|
||||
* but if no progress is being made, there are no other
|
||||
* options and retrying is unlikely to help
|
||||
* The OOM killer does not trigger for high-order
|
||||
* ~__GFP_NOFAIL allocations so if no progress is being
|
||||
* made, there are no other options and retrying is
|
||||
* unlikely to help.
|
||||
*/
|
||||
if (order > PAGE_ALLOC_COSTLY_ORDER)
|
||||
if (order > PAGE_ALLOC_COSTLY_ORDER &&
|
||||
!(gfp_mask & __GFP_NOFAIL))
|
||||
goto nopage;
|
||||
|
||||
goto restart;
|
||||
|
||||
Reference in new issue
Block a user