Linux cgroups development
 help / color / mirror / Atom feed
From: Shakeel Butt <shakeel.butt@linux.dev>
To: Johannes Weiner <hannes@cmpxchg.org>
Cc: Usama Arif <usama.arif@linux.dev>,
	 Andrew Morton <akpm@linux-foundation.org>,
	david@kernel.org, ljs@kernel.org, liam@infradead.org,
	 vbabka@kernel.org, rppt@kernel.org, surenb@google.com,
	mhocko@suse.com,  kasong@tencent.com, qi.zheng@linux.dev,
	axelrasmussen@google.com, yuanchu@google.com,
	 weixugc@google.com, chrisl@kernel.org, nphamcs@gmail.com,
	baoquan.he@linux.dev,  youngjun.park@lge.com,
	roman.gushchin@linux.dev, muchun.song@linux.dev,
	 linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	cgroups@vger.kernel.org,  rientjes@google.com,
	kernel-team@meta.com
Subject: Re: [PATCH v4 2/2] mm/vmscan: reduce lru_lock contention via vmstat-derived scan-balance cost
Date: Mon, 27 Jul 2026 07:28:25 -0700	[thread overview]
Message-ID: <amdn2Kcfe9owkDWN@linux.dev> (raw)
In-Reply-To: <amdjsVuNYW98Q--Z@cmpxchg.org>

On Mon, Jul 27, 2026 at 09:57:05AM -0400, Johannes Weiner wrote:
> On Fri, Jul 24, 2026 at 02:32:52PM -0400, Johannes Weiner wrote:
> > On Fri, Jul 24, 2026 at 02:29:23PM +0100, Usama Arif wrote:
> > > 

[...]

> > > 
> > > > 
> > > > The patch looks good but I have one question. We already have concept of
> > > > pgrotated through /proc/vmstat which represents number of pages we have moved to
> > > > the tail of inactive LRU to make them next reclaim candidates. This patch is
> > > > exposing pgrotate_[anon|file] to userspace. Here these metrics represents either
> > > > the number of pages we scanned but didn't reclaim plus number of pages given one
> > > > more trip in the active LRU.
> > > > 
> > > > Older and newer pgrotate metrics kind of represent something different. It may
> > > > cause confusion. Now before suggesting to change the name, let me ask do we
> > > > really need to expose these to the userspace? How exactly users can use these
> > > > new metrics? I think you can use them here without exposing to userspace. So,
> > > > does it makes sense to delay userspace exposure later when we have a more solid
> > > > usecase for that unless you have it already.
> > > > 
> > > 
> > > I do think the userspace counters have diagnostic value. They can be another metric
> > > to show how much anon/file reclaim work is spent on pages that are not immediately
> > > reclaimed, including pages retained on actie LRU. It could help explain if there
> > > is elevated reclaim CPU usage.
> > 
> > Hm, this is an interesting discussion.
> > 
> > The existing PGROTATED is kind of useless. When it's bumped:
> > 
> > - truncation fails and moves folios to the LRU tail for faster reclaim
> > - writeback ends on folio that was tried to reclaim, moves to LRU tail for fast retry

Yes PGROTATED only tells number of pages moved to LRU tail and nothing about the
why. I can see that from user's perspective the why part is more important.

> > 
> > Ok, who needs to know this? The new counters you're adding, on the
> > other hand, they capture the information you frequently need for
> > understanding reclaim behavior.
> > 
> > That said, looking closer at this one more time, you can already
> > (almost) derive them fully from existing counters:
> > 
> > drotated = (dPGSCAN_ANON - dPGSTEAL_ANON) + dPGDEACTIVATE_ANON
> 
> Talking with Usama offlist, there are two problems with this:
> 
> - PGDEACTIVATE is obviously wrong. We want the the pages we don't
>   deactivate (hot file executables)
> 
> - PGSCAN includes things that didn't work out due to caller
>   restrictions (reclaim_idx) and race conditions (tryget, !lru) that
>   shouldn't contribute to the balance.
> 
> So let's go with PGROTATE as Usama proposed.
> 
> But I'm against hiding them from the vmstats.
> 
> I'd rather remove or rename the existing one if we're worried about
> confusion. We've historically applied a much lower bar to vmstat
> stability. It's geared towards understanding detailed MM behavior
> behavior, which undergoes constant changes.

Let's keep the deprecation part orthogonal to this series. No objection from me
if these new metrics help in understanding the MM reclaim behavior. The only
request I have is to introduce these metrics as a separate independent patch.
First introduce the metrics with the detail on how they can be useful and then
later use them for the internal balancing algorithm.


  reply	other threads:[~2026-07-27 14:28 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-20 16:41 [PATCH v4 0/2] mm/vmscan: reduce lru_lock contention via vmstat-derived scan-balance cost Usama Arif
2026-07-20 16:41 ` [PATCH v4 1/2] mm/vmstat, mm/memcontrol: add _monotonic vmstat readers Usama Arif
2026-07-23 19:41   ` Shakeel Butt
2026-07-20 16:41 ` [PATCH v4 2/2] mm/vmscan: reduce lru_lock contention via vmstat-derived scan-balance cost Usama Arif
2026-07-23 20:25   ` Johannes Weiner
2026-07-24  1:53   ` Shakeel Butt
2026-07-24 13:29     ` Usama Arif
2026-07-24 15:49       ` Shakeel Butt
2026-07-24 18:32       ` Johannes Weiner
2026-07-27 13:57         ` Johannes Weiner
2026-07-27 14:28           ` Shakeel Butt [this message]
2026-07-23 20:35 ` [PATCH v4 0/2] " Andrew Morton
2026-07-24 13:31   ` Usama Arif

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=amdn2Kcfe9owkDWN@linux.dev \
    --to=shakeel.butt@linux.dev \
    --cc=akpm@linux-foundation.org \
    --cc=axelrasmussen@google.com \
    --cc=baoquan.he@linux.dev \
    --cc=cgroups@vger.kernel.org \
    --cc=chrisl@kernel.org \
    --cc=david@kernel.org \
    --cc=hannes@cmpxchg.org \
    --cc=kasong@tencent.com \
    --cc=kernel-team@meta.com \
    --cc=liam@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=ljs@kernel.org \
    --cc=mhocko@suse.com \
    --cc=muchun.song@linux.dev \
    --cc=nphamcs@gmail.com \
    --cc=qi.zheng@linux.dev \
    --cc=rientjes@google.com \
    --cc=roman.gushchin@linux.dev \
    --cc=rppt@kernel.org \
    --cc=surenb@google.com \
    --cc=usama.arif@linux.dev \
    --cc=vbabka@kernel.org \
    --cc=weixugc@google.com \
    --cc=youngjun.park@lge.com \
    --cc=yuanchu@google.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