Message ID | 20250407041810.13861-2-harry.yoo@oracle.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | slabinfo: sheaves statistics support | expand |
On Mon, 7 Apr 2025, Harry Yoo wrote: > 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. > Thoughts on adding an entry to Documentation/ABI/testing/sysfs-kernel-slab for this one? > 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 > >
On Tue, Apr 08, 2025 at 07:45:38PM -0700, David Rientjes wrote: > On Mon, 7 Apr 2025, Harry Yoo wrote: > > > 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. > > > > Thoughts on adding an entry to Documentation/ABI/testing/sysfs-kernel-slab > for this one? That makes sense, thanks! New stats added by the sheaves series should also be there. ...By the way I'm a bit unsure about the name. 'sheaves', 'has_sheaves' or 'sheaves_enabled'?
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,
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(+)