Re: [PATCH 09/10] memcg_slabinfo: Fix use of PG_slab

Harry Yoo
2025-06-09T03:09:03Z

On Fri, Jun 06, 2025 at 11:22:11PM +0100, Matthew Wilcox (Oracle) wrote:
> Check PGTY_slab instead of PG_slab.
>
> Fixes: 4ffca5a96678 (mm: support only one page_type per page)
> Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
> Tested-by: Roman Gushchin <roman.gushchin@linux.dev>
> Reviewed-by: Roman Gushchin <roman.gushchin@linux.dev>
> ---

Reviewed-by: Harry Yoo <harry.yoo@oracle.com>

> tools/cgroup/memcg_slabinfo.py | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/tools/cgroup/memcg_slabinfo.py b/tools/cgroup/memcg_slabinfo.py
> index 270c28a0d098..6bf4bde77903 100644
> --- a/tools/cgroup/memcg_slabinfo.py
> +++ b/tools/cgroup/memcg_slabinfo.py
> @@ -146,11 +146,11 @@ def detect_kernel_config():
>
>
> def for_each_slab(prog):
> - PGSlab = ~prog.constant('PG_slab')
> + slabtype = prog.constant('PGTY_slab')
>
> for page in for_each_page(prog):
> try:
> - if page.page_type.value_() == PGSlab:
> + if (page.page_type.value_() >> 24) == slabtype:
> yield cast('struct slab *', page)
> except FaultError:
> pass
> --
> 2.47.2
>
>

--
Cheers,
Harry / Hyeonggon