linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Roman Gushchin <roman.gushchin@linux.dev>
To: Matthew Wilcox <willy@infradead.org>
Cc: linux-mm@kvack.org
Subject: Re: Fixing memcg_slabinfo.py
Date: Fri, 06 Jun 2025 14:37:14 -0700	[thread overview]
Message-ID: <87o6v0lfg5.fsf@linux.dev> (raw)
In-Reply-To: <aEMmUzCjiaJ7kLmU@casper.infradead.org> (Matthew Wilcox's message of "Fri, 6 Jun 2025 18:33:07 +0100")

Matthew Wilcox <willy@infradead.org> writes:

> Looks like nobody's used memcg_slabinfo.py in the last year when I broke
> it with 4ffca5a96678.  It should probably be fixed, but I'm not fluent
> in Python and don't use drgn myself, so have no way to verify the below
> is even syntactically correct, let alone works.

Hi Matthew!

The patch looks good to me (assuming a proper commit log). I gave it a
test on top of 6.14.9 (which is running my Fedora laptop currently) and
it worked fine.

Tested-by: Roman Gushchin <roman.gushchin@linux.dev>
Reviewed-by: Roman Gushchin <roman.gushchin@linux.dev>

Thanks!

>
> diff --git a/tools/cgroup/memcg_slabinfo.py b/tools/cgroup/memcg_slabinfo.py
> index 270c28a0d098..bb3de16e3510 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')
> +    PGTYslab = prog.constant('PGTY_slab')
>  
>      for page in for_each_page(prog):
>          try:
> -            if page.page_type.value_() == PGSlab:
> +            if (page.page_type.value_() >> 24) == PGTYslab:
>                  yield cast('struct slab *', page)
>          except FaultError:
>              pass


      reply	other threads:[~2025-06-06 21:37 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-06 17:33 Fixing memcg_slabinfo.py Matthew Wilcox
2025-06-06 21:37 ` Roman Gushchin [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87o6v0lfg5.fsf@linux.dev \
    --to=roman.gushchin@linux.dev \
    --cc=linux-mm@kvack.org \
    --cc=willy@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).