[PATCH 2/3] mm/slab: document that sheaf refill does not require blocking

From: Andreas Hindborg

Date: Wed Nov 25 2026 - 14:35:47 EST


The documentation of the sheaf_capacity member of struct kmem_cache_args
states that when no full sheaf is available, a sheaf is only allocated and
filled if the gfp flags allow blocking, and that the allocation otherwise
falls back to allocating a single object from a slab.

This has not been the case since commit fb1091febd66 ("mm/slab: allow sheaf
refill if blocking is not allowed"). __pcs_replace_empty_main() now refills
a sheaf whenever spinning is allowed. Only kmalloc_nolock() disallows
spinning, and it allocates from the kmalloc caches, so for caches created
with kmem_cache_create() the refill is attempted regardless of the gfp
flags.

Drop the condition from the documentation, and describe the fallback as
what happens when the sheaf cannot be allocated or filled.

Fixes: fb1091febd66 ("mm/slab: allow sheaf refill if blocking is not allowed")
Signed-off-by: Andreas Hindborg <a.hindborg@xxxxxxxxxx>
---
include/linux/slab.h | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/include/linux/slab.h b/include/linux/slab.h
index 64daeb239f78..8f484e1edcd2 100644
--- a/include/linux/slab.h
+++ b/include/linux/slab.h
@@ -358,10 +358,10 @@ struct kmem_cache_args {
* that may be not present. When both become empty, there's an attempt
* to replace an empty sheaf with a full sheaf from the per-node barn.
*
- * When no full sheaf is available, and gfp flags allow blocking, a
- * sheaf is allocated and filled from slab(s) using bulk allocation.
- * Otherwise the allocation falls back to the normal operation
- * allocating a single object from a slab.
+ * When no full sheaf is available, a sheaf is allocated and filled
+ * from slab(s) using bulk allocation. If that fails, the allocation
+ * falls back to the normal operation allocating a single object from
+ * a slab.
*
* Analogically when freeing and both percpu sheaves are full, the barn
* may replace it with an empty sheaf, unless it's over capacity. In

--
2.54.0