linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: Roman Gushchin <guro@fb.com>
Cc: Vasily Averin <vvs@virtuozzo.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Linux MM <linux-mm@kvack.org>, Vlastimil Babka <vbabka@suse.cz>
Subject: Re: tools/cgroup/memcg_slabinfo.py is broken
Date: Wed, 16 Feb 2022 23:12:02 +0000	[thread overview]
Message-ID: <Yg2EwqE07d97gmms@casper.infradead.org> (raw)
In-Reply-To: <Yg16ClVQj8SLSlqV@carbon.DHCP.thefacebook.com>

On Wed, Feb 16, 2022 at 02:26:18PM -0800, Roman Gushchin wrote:
> On Wed, Feb 16, 2022 at 09:55:29PM +0000, Matthew Wilcox wrote:
> > On Wed, Feb 16, 2022 at 01:44:10PM -0800, Roman Gushchin wrote:
> > > On Wed, Feb 16, 2022 at 09:12:01PM +0000, Matthew Wilcox wrote:
> > > > On Wed, Feb 16, 2022 at 12:52:36PM -0800, Roman Gushchin wrote:
> > > > > The problem can be fixed by explicitly casting struct page * to struct
> > > > > slab * for slab pages. The tools works as expected with this fix, e.g.:
> > > > 
> > > > This feels like a quick fix, and not really correct.
> > > 
> > > Do you mind to provide a correct version?
> > 
> > I know nothing about python, nor how to even run this script.  But this
> > is the kind of thing I was thinking about.
> > 
> > I didn't do the 'skip over tail pages' because I have no idea how
> > you'd tell for_each_page() to do that.  I don't know where to get
> > drgn.helpers.linux from, so I can't look at the implementation.
> > Maybe it already does that.
> 
> Is there an actual plan to set the slab flag for tail pages?
> If not, why to check both? It's fairly expensive already, so I'd
> not add any additional checks if there is no strict necessity.

The plan to set the slab flag on tail pages is probably about five
years away.  There are a lot of moving parts before we get there.
I think you could reduce the cost if we had a for_each_folio()
loop.  Most code doesn't really want to look at every page, so
having a shorter list (and iterating over each page within a folio
for the few places that really do want to see every page) would
be a good tradeoff.

> > @@ -145,14 +145,14 @@ def detect_kernel_config():
> >      return cfg
> >  
> >  
> > -def for_each_slab_page(prog):
> > +def for_each_slab(prog):
> 
> Here I'd keep _page (or _folio, if you want), because
> it makes it clear that the function goes over all pages
> (and is expensive therefore).

But there's no intrinsic reason that it should.  If that's a
performance problem, you could keep slabs on a separate list
from, eg, file or anon memory.



  parent reply	other threads:[~2022-02-16 23:12 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-15 13:22 tools/cgroup/memcg_slabinfo.py is broken Vasily Averin
2022-02-15 23:29 ` Roman Gushchin
     [not found]   ` <35486a00-791c-3b1b-14e0-476e6242709b@virtuozzo.com>
     [not found]     ` <Yg1kFH3umdrvOhu1@carbon.dhcp.thefacebook.com>
2022-02-16 21:12       ` Matthew Wilcox
2022-02-16 21:44         ` Roman Gushchin
     [not found]           ` <Yg1y0ax5bnjGLAqz@casper.infradead.org>
     [not found]             ` <Yg16ClVQj8SLSlqV@carbon.DHCP.thefacebook.com>
2022-02-16 23:12               ` Matthew Wilcox [this message]
2022-02-16 23:57                 ` Shakeel Butt
2022-02-17  0:13                   ` Matthew Wilcox
2022-02-17  0:25                     ` Roman Gushchin
     [not found]                     ` <Yg2cKKnIboNu7j+p@carbon.DHCP.thefacebook.com>
     [not found]                       ` <11060a75-98c2-f547-68eb-fcab404a2539@virtuozzo.com>
2022-02-21  9:19                         ` Vlastimil Babka
2022-02-21 13:27                       ` Matthew Wilcox

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=Yg2EwqE07d97gmms@casper.infradead.org \
    --to=willy@infradead.org \
    --cc=akpm@linux-foundation.org \
    --cc=guro@fb.com \
    --cc=linux-mm@kvack.org \
    --cc=vbabka@suse.cz \
    --cc=vvs@virtuozzo.com \
    /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).