mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andreas Hindborg <a.hindborg@kernel.org>
To: Vlastimil Babka <vbabka@kernel.org>, Harry Yoo <harry@kernel.org>,
	 Hao Li <hao.li@linux.dev>, Christoph Lameter <cl@gentwo.org>,
	 David Rientjes <rientjes@google.com>,
	 Roman Gushchin <roman.gushchin@linux.dev>,
	 "Liam R. Howlett" <liam@infradead.org>,
	 Suren Baghdasaryan <surenb@google.com>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	 Andreas Hindborg <a.hindborg@kernel.org>
Subject: [PATCH 2/3] mm/slab: document that sheaf refill does not require blocking
Date: Wed, 25 Nov 2026 20:35:13 +0100	[thread overview]
Message-ID: <20261125-sheaf-doc-update-v1-2-4a579abaf0b8@kernel.org> (raw)
In-Reply-To: <20261125-sheaf-doc-update-v1-0-4a579abaf0b8@kernel.org>

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@kernel.org>
---
 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



  parent reply	other threads:[~2026-11-25 19:35 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-25 19:35 [PATCH 0/3] mm/slab: update the sheaf documentation in kmem_cache_args Andreas Hindborg
2026-11-25 19:35 ` [PATCH 1/3] mm/slab: update the documentation of sheaf_capacity Andreas Hindborg
2026-11-25 19:35 ` Andreas Hindborg [this message]
2026-11-25 19:35 ` [PATCH 3/3] mm/slab: document that local node allocations can use sheaves Andreas Hindborg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261125-sheaf-doc-update-v1-2-4a579abaf0b8@kernel.org \
    --to=a.hindborg@kernel.org \
    --cc=cl@gentwo.org \
    --cc=hao.li@linux.dev \
    --cc=harry@kernel.org \
    --cc=liam@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=rientjes@google.com \
    --cc=roman.gushchin@linux.dev \
    --cc=surenb@google.com \
    --cc=vbabka@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®