Re: [PATCH v3] tools/cgroup/slabinfo: Fix use of slab.memcg_data
From: Harry Yoo (Oracle)
Date: Tue May 12 2026 - 06:20:08 EST
On Wed, Apr 22, 2026 at 03:39:00PM +0800, Hongfu Li wrote:
> After the introduce slabobj_ext to support slab object extensions, the
> memcg_slabinfo tool broke. An attempt to run it produces a trace like
> this:
> Traceback (most recent call last):
> File "/usr/local/bin/drgn", line 8, in <module>
> sys.exit(_main())
> ^^^^^^^
> File "/usr/local/lib64/python3.11/site-packages/drgn/cli.py", line 688, in _main
> runpy.run_path(
> File "<frozen runpy>", line 291, in run_path
> File "<frozen runpy>", line 98, in _run_module_code
> File "<frozen runpy>", line 88, in _run_code
> File "/root/memcg_slabinfo.py", line 225, in <module>
> main()
> File "/root/memcg_slabinfo.py", line 195, in main
> objcg_vec_raw = slab.memcg_data.value_()
> AttributeError: 'struct slab' has no member 'memcg_data'
>
> Fixes: 21c690a349ba ("mm: introduce slabobj_ext to support slab object extensions")
> Fixes: 5ba6bc27b1f9 ("slab: decouple pointer to barn from kmem_cache_node")
> Signed-off-by: Hongfu Li <lihongfu@xxxxxxxxxx>
> ---
Acked-by: Harry Yoo (Oracle) <harry@xxxxxxxxxx>
> v3:
> - Add a compatibility accessor for per-node cache state (per_node[nid].node vs node[nid])
> - Link to v2: https://lore.kernel.org/all/20260421055829.3930289-1-lihongfu@xxxxxxxxxx/
> v2:
> - Skip slabs after masking when the base is zero (OBJEXTS_ALLOC_FAIL).
> - Walk slab->obj_exts using base + stride * i (same indexing as slab_obj_ext()).
> - Link to v1: https://lore.kernel.org/all/20260417020729.952897-1-lihongfu@xxxxxxxxxx/
--
Cheers,
Harry / Hyeonggon