From: Thomas Weißschuh Date: Tue, 14 Oct 2025 12:17:23 +0000 (+0200) Subject: mempool: clarify behavior of mempool_alloc_preallocated() X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=364371131f26d6195a457d9696e9b67815be6b32;p=users%2Fjedix%2Flinux-maple.git mempool: clarify behavior of mempool_alloc_preallocated() The documentation of that function promises to never sleep. However on PREEMPT_RT a spinlock_t might in fact sleep. Reword the documentation so users can predict its behavior better. mempool could also replace spinlock_t with raw_spinlock_t which doesn't sleep even on PREEMPT_RT but that would take away the improved preemptibility of sleeping locks. Link: https://lkml.kernel.org/r/20251014-mempool-doc-v1-1-bc9ebf169700@linutronix.de Signed-off-by: Thomas Weißschuh Cc: Christoph Lameter Cc: David Rientjes Cc: Roman Gushchin Cc: Sebastian Andrzej Siewior Cc: Steven Rostedt Cc: Vlastimil Babka Signed-off-by: Andrew Morton --- diff --git a/mm/mempool.c b/mm/mempool.c index 1c38e873e546..cceb09b75ebe 100644 --- a/mm/mempool.c +++ b/mm/mempool.c @@ -461,8 +461,8 @@ EXPORT_SYMBOL(mempool_alloc_noprof); * mempool_create(). * * This function is similar to mempool_alloc, but it only attempts allocating - * an element from the preallocated elements. It does not sleep and immediately - * returns if no preallocated elements are available. + * an element from the preallocated elements. It only takes a single spinlock_t + * and immediately returns if no preallocated elements are available. * * Return: pointer to the allocated element or %NULL if no elements are * available.