From: "Vlastimil Babka (SUSE)" <vbabka@kernel.org>
To: Ming Lei <ming.lei@redhat.com>, Harry Yoo <harry.yoo@oracle.com>
Cc: Hao Li <hao.li@linux.dev>,
Andrew Morton <akpm@linux-foundation.org>,
Christoph Lameter <cl@gentwo.org>,
David Rientjes <rientjes@google.com>,
Roman Gushchin <roman.gushchin@linux.dev>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 0/3] slab: support memoryless nodes with sheaves
Date: Mon, 16 Mar 2026 14:33:52 +0100 [thread overview]
Message-ID: <e8c824d2-2234-4a29-8dc2-5de9f638b114@kernel.org> (raw)
In-Reply-To: <20260311-b4-slab-memoryless-barns-v1-0-70ab850be4ce@kernel.org>
On 3/11/26 09:25, Vlastimil Babka (SUSE) wrote:
> This is the draft patch from [1] turned into a proper series with
> incremental changes. It's based on v7.0-rc3. It's too intrusive for a
> 7.0 hotfix, so we'll only be able to fix/reduce the regression in 7.1. I
> hope it's acceptable given it's a non-standard configuration, 7.0 is not
> a LTS, and it's a perf regression, not functionality.
>
> Ming can you please retest this on top of v7.0-rc3, which already has
> fb1091febd66 ("mm/slab: allow sheaf refill if blocking is not
> allowed"). Separate data point for v7.0-rc3 could be also useful.
>
> [1] https://lore.kernel.org/all/c6a01f7e-c6eb-454b-9b9e-734526dd659d@kernel.org/
>
> Signed-off-by: Vlastimil Babka (SUSE) <vbabka@kernel.org>
> ---
> Vlastimil Babka (SUSE) (3):
> slab: decouple pointer to barn from kmem_cache_node
> slab: create barns for online memoryless nodes
> slab: free remote objects to sheaves on memoryless nodes
>
> mm/slab.h | 7 +-
> mm/slub.c | 256 +++++++++++++++++++++++++++++++++++++++++++++-----------------
> 2 files changed, 191 insertions(+), 72 deletions(-)
> ---
> base-commit: 1f318b96cc84d7c2ab792fcc0bfd42a7ca890681
> change-id: 20260311-b4-slab-memoryless-barns-fad64172ba05
>
> Best regards,
Range-diff in slab/for-7.1/sheaves after applying Harry's feedback:
2: cc67056e94f1 ! 472: b002755da434 slab: decouple pointer to barn from kmem_cache_node
@@ Commit message
Link: https://patch.msgid.link/20260311-b4-slab-memoryless-barns-v1-1-70ab850be4ce@kernel.org
Signed-off-by: Vlastimil Babka (SUSE) <vbabka@kernel.org>
+ Reviewed-by: Harry Yoo <harry.yoo@oracle.com>
## mm/slab.h ##
@@ mm/slab.h: struct kmem_cache_order_objects {
@@ mm/slub.c: struct kmem_cache_node {
/*
- * Get the barn of the current cpu's closest memory node. It may not exist on
- * systems with memoryless nodes but without CONFIG_HAVE_MEMORYLESS_NODES
-+ * Get the barn of the current cpu's memory node. It may be a memoryless node.
++ * Get the barn of the current cpu's NUMA node. It may be a memoryless node.
*/
static inline struct node_barn *get_barn(struct kmem_cache *s)
{
@@ mm/slub.c: struct kmem_cache_node {
- return NULL;
-
- return n->barn;
-+ return get_barn_node(s, numa_node_id());
++ return get_barn_node(s, numa_mem_id());
}
/*
3: 285bca63cf15 ! 473: f811cc3d9f6e slab: create barns for online memoryless nodes
@@ Commit message
nodes, tracked in a new nodemask slab_barn_nodes. Also add a cpu hotplug
callback as that's when a memoryless node can become online.
- Change rcu_sheaf->node assignment to numa_node_id() so it's returned to
- the barn of the local cpu's (potentially memoryless) node, and not to
- the nearest node with memory anymore.
+ Change both get_barn() and rcu_sheaf->node assignment to numa_node_id()
+ so it's returned to the barn of the local cpu's (potentially memoryless)
+ node, and not to the nearest node with memory anymore.
+
+ On systems with CONFIG_HAVE_MEMORYLESS_NODES=y (which are not the main
+ target of this change) barns did not exist on memoryless nodes, but
+ get_barn() using numa_mem_id() meant a barn was returned from the
+ nearest node with memory. This works, but the barn lock contention
+ increases with every such memoryless node. With this change, barn will
+ be allocated also on the memoryless node, reducing this contention in
+ exchange for increased memory consumption.
Reported-by: Ming Lei <ming.lei@redhat.com>
Link: https://lore.kernel.org/all/aZ0SbIqaIkwoW2mB@fedora/ [1]
Link: https://patch.msgid.link/20260311-b4-slab-memoryless-barns-v1-2-70ab850be4ce@kernel.org
Signed-off-by: Vlastimil Babka (SUSE) <vbabka@kernel.org>
+ Reviewed-by: Harry Yoo <harry.yoo@oracle.com>
## mm/slub.c ##
+@@ mm/slub.c: static inline struct node_barn *get_barn_node(struct kmem_cache *s, int node)
+ */
+ static inline struct node_barn *get_barn(struct kmem_cache *s)
+ {
+- return get_barn_node(s, numa_mem_id());
++ return get_barn_node(s, numa_node_id());
+ }
+
+ /*
@@ mm/slub.c: static inline struct node_barn *get_barn(struct kmem_cache *s)
*/
static nodemask_t slab_nodes;
4: 1fe49af3aa46 ! 474: 86e18f36844f slab: free remote objects to sheaves on memoryless nodes
@@ Commit message
Link: https://patch.msgid.link/20260311-b4-slab-memoryless-barns-v1-3-70ab850be4ce@kernel.org
Signed-off-by: Vlastimil Babka (SUSE) <vbabka@kernel.org>
+ Reviewed-by: Harry Yoo <harry.yoo@oracle.com>
## mm/slub.c ##
@@ mm/slub.c: bool __kfree_rcu_sheaf(struct kmem_cache *s, void *obj)
prev parent reply other threads:[~2026-03-16 13:33 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-11 8:25 Vlastimil Babka (SUSE)
2026-03-11 8:25 ` [PATCH 1/3] slab: decouple pointer to barn from kmem_cache_node Vlastimil Babka (SUSE)
2026-03-13 9:27 ` Harry Yoo
2026-03-13 9:46 ` Vlastimil Babka (SUSE)
2026-03-13 11:48 ` Harry Yoo
2026-03-16 13:19 ` Vlastimil Babka (SUSE)
2026-03-11 8:25 ` [PATCH 2/3] slab: create barns for online memoryless nodes Vlastimil Babka (SUSE)
2026-03-16 3:25 ` Harry Yoo
2026-03-18 9:27 ` Hao Li
2026-03-18 12:11 ` Vlastimil Babka (SUSE)
2026-03-19 7:01 ` Hao Li
2026-03-19 9:56 ` Vlastimil Babka (SUSE)
2026-03-19 11:27 ` Hao Li
2026-03-19 12:25 ` Vlastimil Babka (SUSE)
2026-03-11 8:25 ` [PATCH 3/3] slab: free remote objects to sheaves on " Vlastimil Babka (SUSE)
2026-03-16 3:48 ` Harry Yoo
2026-03-11 9:49 ` [PATCH 0/3] slab: support memoryless nodes with sheaves Ming Lei
2026-03-11 17:22 ` Vlastimil Babka (SUSE)
2026-04-08 13:04 ` Jon Hunter
2026-04-08 14:06 ` Hao Li
2026-04-08 14:31 ` Harry Yoo (Oracle)
2026-03-16 13:33 ` Vlastimil Babka (SUSE) [this message]
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=e8c824d2-2234-4a29-8dc2-5de9f638b114@kernel.org \
--to=vbabka@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=cl@gentwo.org \
--cc=hao.li@linux.dev \
--cc=harry.yoo@oracle.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=ming.lei@redhat.com \
--cc=rientjes@google.com \
--cc=roman.gushchin@linux.dev \
/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