From: Seongjun Hong <hsj0512@snu.ac.kr>
To: Vlastimil Babka <vbabka@kernel.org>, Harry Yoo <harry@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
Hao Li <hao.li@linux.dev>, Christoph Lameter <cl@gentwo.org>,
David Rientjes <rientjes@google.com>,
Roman Gushchin <roman.gushchin@linux.dev>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
Seongjun Hong <hsj0512@snu.ac.kr>
Subject: [PATCH 2/2] tools/mm/slabinfo: report percpu sheaves and barn statistics
Date: Sun, 27 Sep 2026 05:57:28 +0000 [thread overview]
Message-ID: <20260927-tools-mm-update-slabinfo-v1-2-a4ea0d4dc136@snu.ac.kr> (raw)
In-Reply-To: <20260927-tools-mm-update-slabinfo-v1-0-a4ea0d4dc136@snu.ac.kr>
Since commit 2d517aa09bbc ("slab: add opt-in caching layer of percpu
sheaves") sysfs provides the statistics of sheaf and barn, but slabinfo
did not utilize this information. Display perf, API, and sheaf allocation
counters on slabinfo report(-r).
Example slabinfo report output:
$ slabinfo -r kmalloc-1k
Sheaf capacity 12 objects
Sheaf Perf Counter Success Fail
--------------------------------------------------
Barn get 4 43
Barn put 4 0
RCU sheaf free 34 0
Sheaf API Counter Fast Slow
--------------------------------------------------
Prefill 0 0
Return 0 0
Sheaf Objects/Allocations
--------------------------------------------------
Objects flushed to slabs 0
Objects refilled into sheaves 516
Sheaves allocated 7
Sheaves freed 0
Oversize sheaves for prefill 0
Signed-off-by: Seongjun Hong <hsj0512@snu.ac.kr>
---
tools/mm/slabinfo.c | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 58 insertions(+)
diff --git a/tools/mm/slabinfo.c b/tools/mm/slabinfo.c
index 84359d628f2e..dbc72582ffab 100644
--- a/tools/mm/slabinfo.c
+++ b/tools/mm/slabinfo.c
@@ -33,6 +33,7 @@ struct slabinfo {
unsigned int slab_size, object_size;
unsigned int objs_per_slab, order;
+ unsigned int sheaf_capacity;
unsigned long objects_partial, partial;
int aliases;
unsigned int align;
@@ -49,12 +50,19 @@ struct slabinfo {
/* CONFIG_SLUB_STATS */
unsigned long alloc_fastpath, alloc_slowpath;
+ unsigned long free_rcu_sheaf, free_rcu_sheaf_fail;
unsigned long free_fastpath, free_slowpath;
unsigned long free_add_partial, free_remove_partial;
unsigned long alloc_slab, alloc_node_mismatch, free_slab;
unsigned long order_fallback;
unsigned long cmpxchg_double_fail;
+ unsigned long sheaf_flush, sheaf_refill, sheaf_alloc, sheaf_free;
+ unsigned long barn_get, barn_get_fail, barn_put, barn_put_fail;
+ unsigned long sheaf_prefill_fast, sheaf_prefill_slow,
+ sheaf_prefill_oversize;
+ unsigned long sheaf_return_fast, sheaf_return_slow;
+
/*
* Deprecated files:
* No STAT_ATTR()/SLAB_ATTR() for these exists in mm/slub.c's
@@ -574,6 +582,39 @@ static void slab_stats(struct slabinfo *s)
}
}
+static void sheaf_stats(struct slabinfo *s)
+{
+ if (!s->sheaf_capacity)
+ return;
+
+ printf("\nSheaf capacity %8u objects\n", s->sheaf_capacity);
+
+ printf("\nSheaf Perf Counter Success Fail\n");
+ printf("--------------------------------------------------\n");
+ printf("Barn get %8lu %8lu\n",
+ s->barn_get, s->barn_get_fail);
+ printf("Barn put %8lu %8lu\n",
+ s->barn_put, s->barn_put_fail);
+ printf("RCU sheaf free %8lu %8lu\n",
+ s->free_rcu_sheaf, s->free_rcu_sheaf_fail);
+
+ printf("\nSheaf API Counter Fast Slow\n");
+ printf("--------------------------------------------------\n");
+ printf("Prefill %8lu %8lu\n",
+ s->sheaf_prefill_fast, s->sheaf_prefill_slow);
+ printf("Return %8lu %8lu\n",
+ s->sheaf_return_fast, s->sheaf_return_slow);
+
+ printf("\nSheaf Objects/Allocations\n");
+ printf("--------------------------------------------------\n");
+ printf("Objects flushed to slabs %8lu\n", s->sheaf_flush);
+ printf("Objects refilled into sheaves %8lu\n", s->sheaf_refill);
+ printf("Sheaves allocated %8lu\n", s->sheaf_alloc);
+ printf("Sheaves freed %8lu\n", s->sheaf_free);
+ printf("Oversize sheaves for prefill %8lu\n",
+ s->sheaf_prefill_oversize);
+}
+
static void report(struct slabinfo *s)
{
if (strcmp(s->name, "*") == 0)
@@ -613,6 +654,7 @@ static void report(struct slabinfo *s)
show_tracking(s);
slab_numa(s, 1);
slab_stats(s);
+ sheaf_stats(s);
}
static void slabcache(struct slabinfo *s)
@@ -1280,6 +1322,22 @@ static void fill_slabinfo(struct slabinfo *slab, const char *name)
slab->cpu_partial_free = get_obj("cpu_partial_free");
slab->alloc_node_mismatch = get_obj("alloc_node_mismatch");
slab->deactivate_bypass = get_obj("deactivate_bypass");
+ slab->sheaf_capacity = get_obj("sheaf_capacity");
+ slab->free_rcu_sheaf = get_obj("free_rcu_sheaf");
+ slab->free_rcu_sheaf_fail = get_obj("free_rcu_sheaf_fail");
+ slab->sheaf_flush = get_obj("sheaf_flush");
+ slab->sheaf_refill = get_obj("sheaf_refill");
+ slab->sheaf_alloc = get_obj("sheaf_alloc");
+ slab->sheaf_free = get_obj("sheaf_free");
+ slab->barn_get = get_obj("barn_get");
+ slab->barn_get_fail = get_obj("barn_get_fail");
+ slab->barn_put = get_obj("barn_put");
+ slab->barn_put_fail = get_obj("barn_put_fail");
+ slab->sheaf_prefill_fast = get_obj("sheaf_prefill_fast");
+ slab->sheaf_prefill_slow = get_obj("sheaf_prefill_slow");
+ slab->sheaf_prefill_oversize = get_obj("sheaf_prefill_oversize");
+ slab->sheaf_return_fast = get_obj("sheaf_return_fast");
+ slab->sheaf_return_slow = get_obj("sheaf_return_slow");
}
static void read_slab_dir(void)
--
2.43.0
next prev parent reply other threads:[~2026-09-27 5:57 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-27 5:57 [PATCH 0/2] tools/mm/slabinfo: report sheaf " Seongjun Hong
2026-09-27 5:57 ` [PATCH 1/2] tools/mm/slabinfo: refactor slab attribute reading Seongjun Hong
2026-09-28 15:52 ` Harry Yoo
2026-10-05 10:43 ` Seongjun Hong
2026-09-27 5:57 ` Seongjun Hong [this message]
2026-09-28 16:00 ` [PATCH 2/2] tools/mm/slabinfo: report percpu sheaves and barn statistics 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=20260927-tools-mm-update-slabinfo-v1-2-a4ea0d4dc136@snu.ac.kr \
--to=hsj0512@snu.ac.kr \
--cc=akpm@linux-foundation.org \
--cc=cl@gentwo.org \
--cc=hao.li@linux.dev \
--cc=harry@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=rientjes@google.com \
--cc=roman.gushchin@linux.dev \
--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®