Re: improve the kmem_cache_alloc_bulk API

"Vlastimil Babka (SUSE)" <[email protected]>
Newsgroups org.kernel.vger.io-uring,org.freedesktop.lists.dri-devel,org.kernel.vger.bpf,org.kernel.vger.linux-arm-msm,org.kernel.vger.linux-kernel,org.kernel.vger.netdev,org.kvack.linux-mm
Message-ID <[email protected]>
On 5/28/26 11:05, Christoph Hellwig wrote:
> On Wed, May 27, 2026 at 04:07:12PM +0200, Vlastimil Babka (SUSE) wrote:
>> commit 46dea1744498 ("slab: refill sheaves from all nodes") from this January.
>> Previously it was just interrupts enabled.
>> 
>> > but by requiring separate functions so I somehow doubt that was meant.
>> 
>> Yeah, it's expressed by the _nolock variants. But slab propagates it internally
>> by the gfp flags, and since 46dea1744498 it affects kmem_cache_alloc_bulk().
> 
> So what are the GFP flags that affect spinning?  I can't find anything
> related to that in either Documentation/core-api/memory-allocation.rst or
> include/linux/gfp_types.h.

See gfpflags_allow_spinning(). The usage by slab and page allocator users
was meant to be via _nolock() variants, not by removing the flags when
calling the normal functions, hence it's not documented. But the abstraction
has now leaked in the kmem_cache_alloc_bulk() case, hm. I think instead of
documenting that, we should adjust the implementation in slab, if possible.
I'll try to look into that.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.