From: Harry Yoo <harry.yoo@oracle.com>
To: Vlastimil Babka <vbabka@suse.cz>,
Christoph Lameter <cl@linux.com>,
David Rientjes <rientjes@google.com>,
linux-mm@kvack.org
Cc: Harry Yoo <harry.yoo@oracle.com>
Subject: [RFC v1 1/2] mm/slab: add sheaves_enabled read-only sysfs file
Date: Mon, 7 Apr 2025 13:18:09 +0900 [thread overview]
Message-ID: <20250407041810.13861-2-harry.yoo@oracle.com> (raw)
In-Reply-To: <20250407041810.13861-1-harry.yoo@oracle.com>
For user-space tools like slabinfo, it is difficult to determine whether
a cache has sheaves enabled. Expose a read-only 'sheaves_enabled' sysfs
file to indicate whether sheaves are enabled for a given cache.
Signed-off-by: Harry Yoo <harry.yoo@oracle.com>
---
mm/slub.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/mm/slub.c b/mm/slub.c
index b5ea66cbbe68..32db440a8b05 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -8504,6 +8504,15 @@ static ssize_t remote_node_defrag_ratio_store(struct kmem_cache *s,
SLAB_ATTR(remote_node_defrag_ratio);
#endif
+static ssize_t sheaves_enabled_show(struct kmem_cache *s, char *buf)
+{
+ if (s->cpu_sheaves)
+ return sysfs_emit(buf, "%u\n", 1);
+ else
+ return sysfs_emit(buf, "%u\n", 0);
+}
+SLAB_ATTR_RO(sheaves_enabled);
+
#ifdef CONFIG_SLUB_STATS
static int show_stat(struct kmem_cache *s, char *buf, enum stat_item si)
{
@@ -8656,6 +8665,7 @@ static struct attribute *slab_attrs[] = {
#ifdef CONFIG_NUMA
&remote_node_defrag_ratio_attr.attr,
#endif
+ &sheaves_enabled_attr.attr,
#ifdef CONFIG_SLUB_STATS
&alloc_cpu_sheaf_attr.attr,
&alloc_fastpath_attr.attr,
--
2.43.0
next prev parent reply other threads:[~2025-04-07 4:18 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-07 4:18 [RFC v1 0/2] slabinfo: sheaves statistics support Harry Yoo
2025-04-07 4:18 ` Harry Yoo [this message]
2025-04-09 2:45 ` [RFC v1 1/2] mm/slab: add sheaves_enabled read-only sysfs file David Rientjes
2025-04-10 22:32 ` Harry Yoo
2025-04-23 14:24 ` Vlastimil Babka
2025-04-07 4:18 ` [RFC v1 2/2] tools/mm/slabinfo: add support for sheaves stats Harry Yoo
2025-04-07 4:37 ` [RFC v1 0/2] slabinfo: sheaves statistics support Harry Yoo
2025-04-23 14:28 ` Vlastimil Babka
2025-04-25 8:16 ` Harry Yoo
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=20250407041810.13861-2-harry.yoo@oracle.com \
--to=harry.yoo@oracle.com \
--cc=cl@linux.com \
--cc=linux-mm@kvack.org \
--cc=rientjes@google.com \
--cc=vbabka@suse.cz \
/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