Re: [PATCH] tools/mm/slabinfo: fix total_objects attribute name
From: Harry Yoo
Date: Fri Jun 19 2026 - 01:19:16 EST
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@xxxxxxxxxx>
Thanks!
>> Signed-off-by: Yichong Chen <chenyichong@xxxxxxxxxxxxx>
>> ---
>> 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:
OpenPGP_signature.asc
Description: OpenPGP digital signature