On 5/27/26 14:21, Christoph Hellwig wrote:
> On Wed, May 27, 2026 at 11:11:31AM +0200, Vlastimil Babka (SUSE) wrote:
>> > value convention. Fix that and add documentation.
>> >
>> > Note that the few comments explaining it mention that the gfp flags
>> > must allow "spinning". That's not really a term used in the memory
>> > allocator, is this supposed to mean "block" or "sleep"?
>>
>> Page allocator now has alloc_pages_nolock() for when no spinning is
>> possible, and it uses ALLOC_TRYLOCK internally.
>>
>> Slab has kmalloc_nolock() relying on that when it needs new pages.
>
> The comment long predates that, and it isn't expressed using gfp flags,
Do we both mean this comment?
-/* Note that interrupts must be enabled when calling this function. */
+/*
+ * Note that interrupts must be enabled when calling this function and gfp
+ * flags must allow spinning.
+ */
int kmem_cache_alloc_bulk_noprof(struct kmem_cache *s, gfp_t flags, size_t
size,
void **p)
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().
> But I could also not see why it would not support GFP_ATOMIC /
> GFP_NOWAIT allocation, so I might just be confused.
Yeah those are supported because they can spin, just not sleep.