Skip to content

Commit 4823329

Browse files
t-8chtehcaster
authored andcommitted
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 <thomas.weissschuh@linutronix.de> Acked-by: Vlastimil Babka <vbabka@suse.cz> Cc: Christoph Lameter <cl@gentwo.org> Cc: David Rientjes <rientjes@google.com> Cc: Roman Gushchin <roman.gushchin@linux.dev> Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Cc: Steven Rostedt <rostedt@goodmis.org> Cc: "Vishal Moola (Oracle)" <vishal.moola@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
1 parent 07723a4 commit 4823329

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

mm/mempool.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -576,8 +576,8 @@ EXPORT_SYMBOL(mempool_alloc_noprof);
576576
* @pool: pointer to the memory pool
577577
*
578578
* This function is similar to mempool_alloc(), but it only attempts allocating
579-
* an element from the preallocated elements. It does not sleep and immediately
580-
* returns if no preallocated elements are available.
579+
* an element from the preallocated elements. It only takes a single spinlock_t
580+
* and immediately returns if no preallocated elements are available.
581581
*
582582
* Return: pointer to the allocated element or %NULL if no elements are
583583
* available.

0 commit comments

Comments
 (0)