Re: [PATCH] mm: avoid livelock on !__GFP_FS allocations

From: David Rientjes
Date: Tue Oct 25 2011 - 18:18:25 EST


On Tue, 25 Oct 2011, Mel Gorman wrote:

> That said, it will be difficult to remember why checking __GFP_NOFAIL in
> this case is necessary and someone might "optimitise" it away later. It
> would be preferable if it was self-documenting. Maybe something like
> this? (This is totally untested)
>

__GFP_NOFAIL _should_ be optimized away in this case because all he's
passing is __GFP_WAIT | __GFP_NOFAIL. That doesn't make any sense unless
all you want to do is livelock.

__GFP_NOFAIL doesn't mean the page allocator would infinitely loop in all
conditions. That's why GFP_ATOMIC | __GFP_NOFAIL actually fails, and I
would argue that __GFP_WAIT | __GFP_NOFAIL should fail as well since it's
the exact same condition except doesn't have access to the extra memory
reserves.

Suspend needs to either set __GFP_NORETRY to avoid the livelock if it's
going to disable all means of memory reclaiming or freeing in the page
allocator. Or, better yet, just make it GFP_NOWAIT.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/