mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] tools/mm/slabinfo: fix total_objects attribute name
@ 2026-06-12  7:13 Yichong Chen
  2026-06-13  0:29 ` SeongJae Park
  2026-06-18  9:18 ` Vlastimil Babka
  0 siblings, 2 replies; 6+ messages in thread
From: Yichong Chen @ 2026-06-12  7:13 UTC (permalink / raw)
  To: akpm; +Cc: penberg, clameter, linux-mm, linux-kernel, Yichong Chen

SLUB exports the total_objects sysfs attribute, but slabinfo tries to read
objects_total. As a result, the lookup fails and the field remains zero.

Use the correct attribute name and rename the corresponding structure
member to match.

Fixes: 205ab99dd103 ("slub: Update statistics handling for variable order slabs")
Signed-off-by: Yichong Chen <chenyichong@uniontech.com>
---
 tools/mm/slabinfo.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/mm/slabinfo.c b/tools/mm/slabinfo.c
index 54c7265ab52d..f4077746d6df 100644
--- a/tools/mm/slabinfo.c
+++ b/tools/mm/slabinfo.c
@@ -33,7 +33,7 @@ struct slabinfo {
 	unsigned int hwcache_align, object_size, objs_per_slab;
 	unsigned int sanity_checks, slab_size, store_user, trace;
 	int order, poison, reclaim_account, red_zone;
-	unsigned long partial, objects, slabs, objects_partial, objects_total;
+	unsigned long partial, objects, slabs, objects_partial, total_objects;
 	unsigned long alloc_fastpath, alloc_slowpath;
 	unsigned long free_fastpath, free_slowpath;
 	unsigned long free_frozen, free_add_partial, free_remove_partial;
@@ -1263,7 +1263,7 @@ static void read_slab_dir(void)
 			slab->object_size = get_obj("object_size");
 			slab->objects = get_obj("objects");
 			slab->objects_partial = get_obj("objects_partial");
-			slab->objects_total = get_obj("objects_total");
+			slab->total_objects = get_obj("total_objects");
 			slab->objs_per_slab = get_obj("objs_per_slab");
 			slab->order = get_obj("order");
 			slab->partial = get_obj("partial");
-- 
2.51.0


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] tools/mm/slabinfo: fix total_objects attribute name
  2026-06-12  7:13 [PATCH] tools/mm/slabinfo: fix total_objects attribute name Yichong Chen
@ 2026-06-13  0:29 ` SeongJae Park
  2026-06-13  5:20   ` Yichong Chen
  2026-06-15 12:41   ` Vishal Moola
  2026-06-18  9:18 ` Vlastimil Babka
  1 sibling, 2 replies; 6+ messages in thread
From: SeongJae Park @ 2026-06-13  0:29 UTC (permalink / raw)
  To: Yichong Chen
  Cc: SeongJae Park, akpm, penberg, clameter, linux-mm, linux-kernel

On Fri, 12 Jun 2026 15:13:59 +0800 Yichong Chen <chenyichong@uniontech.com> wrote:

> SLUB exports the total_objects sysfs attribute, but slabinfo tries to read
> objects_total. As a result, the lookup fails and the field remains zero.
> 
> Use the correct attribute name and rename the corresponding structure
> member to match.

Good finding, thank you for fixing this!

> 
> Fixes: 205ab99dd103 ("slub: Update statistics handling for variable order slabs")

Should we add Cc: stable@ ?

> Signed-off-by: Yichong Chen <chenyichong@uniontech.com>

Reviewed-by: SeongJae Park <sj@kernel.org>


Thanks,
SJ

[...]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] tools/mm/slabinfo: fix total_objects attribute name
  2026-06-13  0:29 ` SeongJae Park
@ 2026-06-13  5:20   ` Yichong Chen
  2026-06-15 12:41   ` Vishal Moola
  1 sibling, 0 replies; 6+ messages in thread
From: Yichong Chen @ 2026-06-13  5:20 UTC (permalink / raw)
  To: sj; +Cc: akpm, chenyichong, clameter, linux-kernel, linux-mm, penberg

Yes, please add Cc: stable@vger.kernel.org.

Thanks for the review.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] tools/mm/slabinfo: fix total_objects attribute name
  2026-06-13  0:29 ` SeongJae Park
  2026-06-13  5:20   ` Yichong Chen
@ 2026-06-15 12:41   ` Vishal Moola
  1 sibling, 0 replies; 6+ messages in thread
From: Vishal Moola @ 2026-06-15 12:41 UTC (permalink / raw)
  To: SeongJae Park
  Cc: Yichong Chen, akpm, penberg, clameter, linux-mm, linux-kernel

On Fri, Jun 12, 2026 at 05:29:12PM -0700, SeongJae Park wrote:
> On Fri, 12 Jun 2026 15:13:59 +0800 Yichong Chen <chenyichong@uniontech.com> wrote:
> 
> > SLUB exports the total_objects sysfs attribute, but slabinfo tries to read
> > objects_total. As a result, the lookup fails and the field remains zero.
> > 
> > Use the correct attribute name and rename the corresponding structure
> > member to match.
> 
> Good finding, thank you for fixing this!
> 
> > 
> > Fixes: 205ab99dd103 ("slub: Update statistics handling for variable order slabs")
> 
> Should we add Cc: stable@ ?

This variable isn't even used... so we don't need a cc stable. That's
probably why no one spotted it until now too ;)

We should probably be printing it out in another column; I'm not sure
why the initial patch didn't do so.

> > Signed-off-by: Yichong Chen <chenyichong@uniontech.com>
> 
> Reviewed-by: SeongJae Park <sj@kernel.org>
> 
> 
> Thanks,
> SJ
> 
> [...]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] tools/mm/slabinfo: fix total_objects attribute name
  2026-06-12  7:13 [PATCH] tools/mm/slabinfo: fix total_objects attribute name Yichong Chen
  2026-06-13  0:29 ` SeongJae Park
@ 2026-06-18  9:18 ` Vlastimil Babka
  2026-06-19  5:18   ` Harry Yoo
  1 sibling, 1 reply; 6+ messages in thread
From: Vlastimil Babka @ 2026-06-18  9:18 UTC (permalink / raw)
  To: Yichong Chen, akpm, Harry Yoo
  Cc: penberg, clameter, linux-mm, linux-kernel, SeongJae Park, Hao Li

On 6/12/26 09:13, Yichong Chen wrote:
> SLUB exports the total_objects sysfs attribute, but slabinfo tries to read
> objects_total. As a result, the lookup fails and the field remains zero.
> 
> Use the correct attribute name and rename the corresponding structure
> member to match.
> 
> Fixes: 205ab99dd103 ("slub: Update statistics handling for variable order slabs")

Huh, it has never worked correctly, since 2008.
Applied to slab/for-next, thanks!

> Signed-off-by: Yichong Chen <chenyichong@uniontech.com>
> ---
>  tools/mm/slabinfo.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/mm/slabinfo.c b/tools/mm/slabinfo.c
> index 54c7265ab52d..f4077746d6df 100644
> --- a/tools/mm/slabinfo.c
> +++ b/tools/mm/slabinfo.c
> @@ -33,7 +33,7 @@ struct slabinfo {
>  	unsigned int hwcache_align, object_size, objs_per_slab;
>  	unsigned int sanity_checks, slab_size, store_user, trace;
>  	int order, poison, reclaim_account, red_zone;
> -	unsigned long partial, objects, slabs, objects_partial, objects_total;
> +	unsigned long partial, objects, slabs, objects_partial, total_objects;
>  	unsigned long alloc_fastpath, alloc_slowpath;
>  	unsigned long free_fastpath, free_slowpath;
>  	unsigned long free_frozen, free_add_partial, free_remove_partial;
> @@ -1263,7 +1263,7 @@ static void read_slab_dir(void)
>  			slab->object_size = get_obj("object_size");
>  			slab->objects = get_obj("objects");
>  			slab->objects_partial = get_obj("objects_partial");
> -			slab->objects_total = get_obj("objects_total");
> +			slab->total_objects = get_obj("total_objects");
>  			slab->objs_per_slab = get_obj("objs_per_slab");
>  			slab->order = get_obj("order");
>  			slab->partial = get_obj("partial");


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] tools/mm/slabinfo: fix total_objects attribute name
  2026-06-18  9:18 ` Vlastimil Babka
@ 2026-06-19  5:18   ` Harry Yoo
  0 siblings, 0 replies; 6+ messages in thread
From: Harry Yoo @ 2026-06-19  5:18 UTC (permalink / raw)
  To: Vlastimil Babka, Yichong Chen, akpm, Harry Yoo
  Cc: penberg, clameter, linux-mm, linux-kernel, SeongJae Park, Hao Li


[-- Attachment #1.1: Type: text/plain, Size: 2001 bytes --]



On 6/18/26 6:18 PM, Vlastimil Babka wrote:
> On 6/12/26 09:13, Yichong Chen wrote:
>> SLUB exports the total_objects sysfs attribute, but slabinfo tries to read
>> objects_total. As a result, the lookup fails and the field remains zero.
>>
>> Use the correct attribute name and rename the corresponding structure
>> member to match.
>>
>> Fixes: 205ab99dd103 ("slub: Update statistics handling for variable order slabs")
> 
> Huh, it has never worked correctly, since 2008.

slabinfo.c needs some love :)

> Applied to slab/for-next, thanks!

FWIW,
Acked-by: Harry Yoo (Oracle) <harry@kernel.org>

Thanks!

>> Signed-off-by: Yichong Chen <chenyichong@uniontech.com>
>> ---
>>  tools/mm/slabinfo.c | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/tools/mm/slabinfo.c b/tools/mm/slabinfo.c
>> index 54c7265ab52d..f4077746d6df 100644
>> --- a/tools/mm/slabinfo.c
>> +++ b/tools/mm/slabinfo.c
>> @@ -33,7 +33,7 @@ struct slabinfo {
>>  	unsigned int hwcache_align, object_size, objs_per_slab;
>>  	unsigned int sanity_checks, slab_size, store_user, trace;
>>  	int order, poison, reclaim_account, red_zone;
>> -	unsigned long partial, objects, slabs, objects_partial, objects_total;
>> +	unsigned long partial, objects, slabs, objects_partial, total_objects;
>>  	unsigned long alloc_fastpath, alloc_slowpath;
>>  	unsigned long free_fastpath, free_slowpath;
>>  	unsigned long free_frozen, free_add_partial, free_remove_partial;
>> @@ -1263,7 +1263,7 @@ static void read_slab_dir(void)
>>  			slab->object_size = get_obj("object_size");
>>  			slab->objects = get_obj("objects");
>>  			slab->objects_partial = get_obj("objects_partial");
>> -			slab->objects_total = get_obj("objects_total");
>> +			slab->total_objects = get_obj("total_objects");
>>  			slab->objs_per_slab = get_obj("objs_per_slab");
>>  			slab->order = get_obj("order");
>>  			slab->partial = get_obj("partial");

-- 
Cheers,
Harry / Hyeonggon

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-06-19  5:19 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-06-12  7:13 [PATCH] tools/mm/slabinfo: fix total_objects attribute name Yichong Chen
2026-06-13  0:29 ` SeongJae Park
2026-06-13  5:20   ` Yichong Chen
2026-06-15 12:41   ` Vishal Moola
2026-06-18  9:18 ` Vlastimil Babka
2026-06-19  5:18   ` Harry Yoo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox