Re: [PATCH] mm/page_alloc: fix defrag_mode for non-reclaimable allocations

From: Andrew Morton

Date: Mon May 18 2026 - 16:25:02 EST


On Mon, 18 May 2026 16:37:36 +0000 Dmitry Ilvokhin <d@xxxxxxxxxxxx> wrote:

> When defrag_mode is enabled, ALLOC_NOFRAGMENT is enforced to prevent
> migratetype fallbacks and keep pageblocks clean. The allocator relies on
> reclaim and compaction to free pages of the correct type before allowing
> fallback as a last resort.
>
> However, non-reclaimable allocations such as GFP_ATOMIC cannot invoke
> direct reclaim or compaction. With defrag_mode=1, these allocations hit
> the !can_direct_reclaim bailout in __alloc_pages_slowpath() with
> ALLOC_NOFRAGMENT still set, and fail without ever attempting a fallback.
>
> This causes a large number of SLUB allocation failures for
> skbuff_head_cache under network-heavy workloads, despite free memory
> being available in other migratetype freelists.
>
> Clear ALLOC_NOFRAGMENT and retry before giving up on allocations that
> cannot reclaim, following the same pattern used after reclaim/compaction
> exhaustion later in the slowpath.

Thanks. Sashiko asked a couple of things:

https://sashiko.dev/#/patchset/20260518163736.173910-1-d@xxxxxxxxxxxx

I'm not sure what to make of the first one - we aren't holding any locks
in there which prevent concurrent cpuset or zonelist alterations
anyway (?).

But your change might violate the later comment `No "goto retry;" can be
placed above this check * unless it can execute just once'?