From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CA05137AA82 for ; Tue, 21 Apr 2026 10:42:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776768141; cv=none; b=DGUcQfTKqQT2u6aPV7+Ndw9JrfxmXVA209j/pf3f0/eCrESLkm/mDDQuiqspnmtq10SxuBdNSQojSilKVU10DinwFjFLP/wJrrBJPOsF+SsshglWcCkRhVos/g4bMgtqzInPEAERDTP+EBjhkHbEwumKUKb7+hrL/56t5wgWhM0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776768141; c=relaxed/simple; bh=X4FNGL4acdWO/A0iqIWfpppDaTKA2Qxv208rVB24kjA=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Ot5FSN3esmsvvJVFfQqXm31ZbGUSpfkZtEdI5VC+vgI21/nxinWNp/n3jIRQxSant4hOfOtzRrXvpQcHatMLs0JPMBdsLYdt1xmtYw91gpK3ygoHxuctUMnl8GMDSMac6hfDHPDy7y+icswb9yC4u50QzQbode1s3xkyTjRTd44= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=gBe6vwvG; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="gBe6vwvG" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1E73EC2BCB0; Tue, 21 Apr 2026 10:42:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1776768141; bh=X4FNGL4acdWO/A0iqIWfpppDaTKA2Qxv208rVB24kjA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=gBe6vwvGp8OMHBwSawbBBlUhzGZT7QWO3emryBTX7zWojG0AXdNXRpAu+20Pf8F8F k3ISUseQ1soSF1+Zru9BbuNa/0hUxS/1S+Jwva8JVkHiYqeDYFVFMG+ju3m4L2Oc7K iOM5KVCtmf46YIu+BVWgRiPW9X1pIx+DQ6P3iRtq+KDnkIgFRZuHMdTlioI9+4kfK+ 01uM0M4EbGqy3xdkDuJ/qyqjkdlcKXYDX8z0uDqVCR81dbcldcL5gvOLAwpn7m3bGd WrYvvsMlr+5ZJzEAi0yY5N7MSc528dPLTyhPEeoQevTgjtrDvyAjBU0OGMB0ySHWdF HOOImM3wgqtTg== Date: Tue, 21 Apr 2026 19:42:19 +0900 From: "Harry Yoo (Oracle)" To: Hongfu Li Cc: willy@infradead.org, Vlastimil Babka , roman.gushchin@linux.dev, akpm@linux-foundation.org, pasha.tatashin@soleen.com, surenb@google.com, hao.ge@linux.dev, linux-kernel@vger.kernel.org, Hao Li Subject: Re: [PATCH v2] tools/cgroup/slabinfo: Fix use of slab.memcg_data Message-ID: References: <20260421055829.3930289-1-lihongfu@kylinos.cn> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260421055829.3930289-1-lihongfu@kylinos.cn> On Tue, Apr 21, 2026 at 01:58:29PM +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 > sys.exit(_main()) > ^^^^^^^ > File "/usr/local/lib64/python3.11/site-packages/drgn/cli.py", line 688, in _main > runpy.run_path( > File "", line 291, in run_path > File "", line 98, in _run_module_code > File "", line 88, in _run_code > File "/root/memcg_slabinfo.py", line 225, in > 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") > Signed-off-by: Hongfu Li > > Changes in v2: Changes between versions should not be part of the commit message. to the changelog. > - 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()). These two changes looks good to me. > - Link to v1: https://lore.kernel.org/all/20260417020729.952897-1-lihongfu@kylinos.cn/ > --- "Changes since ..." should be under this '---' line so that it won't be included in the commit message. Not sure what kernel version you're using, but due to recent changes in slab (v7.1-rc1), we need this: diff --git a/tools/cgroup/memcg_slabinfo.py b/tools/cgroup/memcg_slabinfo.py old mode 100644 new mode 100755 index b5d4e51671cd..e54e2bb65fe2 --- a/tools/cgroup/memcg_slabinfo.py +++ b/tools/cgroup/memcg_slabinfo.py @@ -101,7 +101,7 @@ def slub_get_slabinfo(s, cfg): nr_free = 0 for node in range(cfg['nr_nodes']): - n = s.node[node] + n = s.per_node[node].node nr_slabs += n.nr_slabs.counter.value_() nr_objs += n.total_objects.counter.value_() nr_free += count_partial(n, count_free) Perhaps you could make it work for kernel w/ and w/o the recent slab changes. (By checking if the field exists and falling back) Please address this and adjust the commit message accordingly. -- Cheers, Harry / Hyeonggon