Thread (34 messages) 34 messages, 9 authors, 2026-04-17

Re: [RFC PATCH] mm: net: disable kswapd for high-order network buffer allocation

From: Shakeel Butt <shakeel.butt@linux.dev>
Date: 2025-10-13 22:25:26
Also in: linux-doc, linux-mm, lkml

On Mon, Oct 13, 2025 at 02:53:17PM -0700, Alexei Starovoitov wrote:
On Mon, Oct 13, 2025 at 2:35 PM Shakeel Butt [off-list ref] wrote:
quoted
On Mon, Oct 13, 2025 at 08:30:13PM +0200, Vlastimil Babka wrote:
[...]
quoted
quoted
I'm a bit worried about proliferating "~__GFP_RECLAIM" allocations now that
we introduced alloc_pages_nolock() and kmalloc_nolock() where it's
interpreted as "cannot spin" - see gfpflags_allow_spinning(). Currently it's
fine for the page allocator itself where we have a different entry point
that uses ALLOC_TRYLOCK, but it can affect nested allocations of all kinds
of debugging and accounting metadata (page_owner, memcg, alloc tags for slab
objects etc). kmalloc_nolock() relies on gfpflags_allow_spinning() fully

I wonder if we should either:

1) sacrifice a new __GFP flag specifically for "!allow_spin" case to
determine it precisely.

2) keep __GFP_KSWAPD_RECLAIM for allocations that remove it for purposes of
not being disturbing (like proposed here), but that can in fact allow
spinning. Instead, decide to not wake up kswapd by those when other
information indicates it's an opportunistic allocation
(~__GFP_DIRECT_RECLAIM, _GFP_NOWARN | __GFP_NORETRY | __GFP_NOMEMALLOC,
order > 0...)

3) something better?
For the !allow_spin allocations, I think we should just add a new __GFP
flag instead of adding more complexity to other allocators which may or
may not want kswapd wakeup for many different reasons.
That's what I proposed long ago, but was convinced that the new flag
adds more complexity. 
Oh somehow I thought we took that route because we are low on available
bits.
Looks like we walked this road far enough and
the new flag will actually make things simpler.
Back then I proposed __GFP_TRYLOCK which is not a good name.
How about __GFP_NOLOCK ? or __GFP_NOSPIN ?
Let's go with __GFP_NOLOCK as we already have nolock variants of the
allocation APIs. 
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help