linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Shakeel Butt <shakeel.butt@linux.dev>
To: Boris Burkov <boris@bur.io>
Cc: linux-btrfs@vger.kernel.org, linux-mm@kvack.org,
	 linux-fsdevel@vger.kernel.org, kernel-team@fb.com, wqu@suse.com,
	willy@infradead.org
Subject: Re: [PATCH v2 2/3] mm: add vmstat for cgroup uncharged pages
Date: Fri, 15 Aug 2025 17:54:50 -0700	[thread overview]
Message-ID: <ivlw4c26cxua6bqzg5zyqsc4xffj3ljkjils4j4c3elhmekwoj@ujlq2q2zvomn> (raw)
In-Reply-To: <ztt2lhdpzfb3ddvgtqqwzuvdmlz4i5l6ijnwizyky4tv62dncz@taho2tjmqjkc>

On Fri, Aug 15, 2025 at 05:48:33PM -0700, Shakeel Butt wrote:
> On Fri, Aug 15, 2025 at 04:40:32PM -0700, Boris Burkov wrote:
> > Uncharged pages are tricky to track by their essential "uncharged"
> > nature. To maintain good accounting, introduce a vmstat counter tracking
> > all uncharged pages. Since this is only meaningful when cgroups are
> > configured, only expose the counter when CONFIG_MEMCG is set.
> > 
> > Confirmed that these work as expected at a high level by mounting a
> > btrfs using AS_UNCHARGED for metadata pages, and seeing the counter rise
> > with fs usage then go back to a minimal level after drop_caches and
> > finally down to 0 after unmounting the fs.
> > 
> > Suggested-by: Shakeel Butt <shakeel.butt@linux.dev>
> > Signed-off-by: Boris Burkov <boris@bur.io>
> > ---
> >  include/linux/mmzone.h |  3 +++
> >  mm/filemap.c           | 17 +++++++++++++++++
> >  mm/vmstat.c            |  3 +++
> >  3 files changed, 23 insertions(+)
> > 
> > diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
> > index 0c5da9141983..f6d885c97e99 100644
> > --- a/include/linux/mmzone.h
> > +++ b/include/linux/mmzone.h
> > @@ -245,6 +245,9 @@ enum node_stat_item {
> >  	NR_HUGETLB,
> >  #endif
> >  	NR_BALLOON_PAGES,
> > +#ifdef CONFIG_MEMCG
> > +	NR_UNCHARGED_FILE_PAGES,
> > +#endif
> >  	NR_VM_NODE_STAT_ITEMS
> >  };
> >  
> > diff --git a/mm/filemap.c b/mm/filemap.c
> > index 6046e7f27709..cd5af44a838c 100644
> > --- a/mm/filemap.c
> > +++ b/mm/filemap.c
> > @@ -146,6 +146,19 @@ static void page_cache_delete(struct address_space *mapping,
> >  	mapping->nrpages -= nr;
> >  }
> >  
> > +#ifdef CONFIG_MEMCG
> > +static void filemap_mod_uncharged_vmstat(struct folio *folio, int sign)
> > +{
> > +	long nr = folio_nr_pages(folio) * sign;
> > +
> > +	lruvec_stat_mod_folio(folio, NR_UNCHARGED_FILE_PAGES, nr);
> 
> Since we 

*never*

> expect to add this metric to memory.stat, I think we should use
> mod_node_page_state() instead here.
> 
> With that you can add:
> 
> Acked-by: Shakeel Butt <shakeel.butt@linux.dev>
> 


  reply	other threads:[~2025-08-16  0:55 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-15 23:40 [PATCH v2 0/3] introduce uncharged file mapped folios Boris Burkov
2025-08-15 23:40 ` [PATCH v2 1/3] mm/filemap: add AS_UNCHARGED Boris Burkov
2025-08-16  0:41   ` Shakeel Butt
2025-08-15 23:40 ` [PATCH v2 2/3] mm: add vmstat for cgroup uncharged pages Boris Burkov
2025-08-16  0:48   ` Shakeel Butt
2025-08-16  0:54     ` Shakeel Butt [this message]
2025-08-15 23:40 ` [PATCH v2 3/3] btrfs: set AS_UNCHARGED on the btree_inode Boris Burkov
2025-08-16  0:50   ` Shakeel Butt
2025-08-16 12:52     ` David Sterba
2025-08-17  8:34 ` [syzbot ci] Re: introduce uncharged file mapped folios syzbot ci
2025-08-18 16:36   ` Shakeel Butt

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=ivlw4c26cxua6bqzg5zyqsc4xffj3ljkjils4j4c3elhmekwoj@ujlq2q2zvomn \
    --to=shakeel.butt@linux.dev \
    --cc=boris@bur.io \
    --cc=kernel-team@fb.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=willy@infradead.org \
    --cc=wqu@suse.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