Messages in this thread Patch in this message | | | Date | Mon, 9 Dec 2013 14:03:45 -0800 (PST) | From | David Rientjes <> | Subject | [patch] mm, page_alloc: allow __GFP_NOFAIL to allocate below watermarks after reclaim |
| |
If direct reclaim has failed to free memory, __GFP_NOFAIL allocations can potentially loop forever in the page allocator. In this case, it's better to give them the ability to access below watermarks so that they may allocate similar to the same privilege given to GFP_ATOMIC allocations.
We're careful to ensure this is only done after direct reclaim has had the chance to free memory, however.
Signed-off-by: David Rientjes <rientjes@google.com> --- mm/page_alloc.c | 5 +++++ 1 file changed, 5 insertions(+)
diff --git a/mm/page_alloc.c b/mm/page_alloc.c --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -2629,6 +2629,11 @@ rebalance: pages_reclaimed)) { /* Wait for some write requests to complete then retry */ wait_iff_congested(preferred_zone, BLK_RW_ASYNC, HZ/50); + + /* Allocations that cannot fail must allocate from somewhere */ + if (gfp_mask & __GFP_NOFAIL) + alloc_flags |= ALLOC_HARDER; + goto rebalance; } else { /*
| |