Re: [PATCH v5 2/3] mm/vmscan: add pgrotate_anon and pgrotate_file vmstat counters

Usama Arif <[email protected]> Wed, 29 Jul 2026 06:09:57 -0700
Newsgroups org.kernel.vger.cgroups,org.kernel.vger.linux-kernel,org.kvack.linux-mm
Message-ID <[email protected]>
On Mon, 27 Jul 2026 09:23:24 -0700 Usama Arif <[email protected]> wrote:

> Reclaim can spend substantial work on an LRU type without immediately
> reclaiming or demoting a corresponding amount of memory. Record this
> work in PGROTATE_ANON and PGROTATE_FILE.
> 
> For classic LRU reclaim:
> 
>   - Inactive-list reclaim adds nr_scanned - nr_reclaimed to the
>     corresponding anon/file counter when isolation succeeds.
>   - Active-list reclaim adds referenced executable file folios that
>     are retained on the active list to PGROTATE_FILE. Active anon
>     reclaim does not contribute this component.
> 
> For MGLRU, add the number of initially isolated pages that remain
> unreclaimed after both the initial and retry passes to the counter for
> the selected anon/file type.
> 
> These counters are distinct from the existing pgrotated vm event.
> pgrotated records an actual move to the inactive-list tail, primarily
> after reclaim-marked writeback completes or failed invalidation leaves
> a folio for accelerated reclaim. PGROTATE_ANON and PGROTATE_FILE
> measure reclaim cost and do not imply that a folio moved to an LRU tail.
> 
> A subsequent patch will consume these counters for anon/file scan
> balancing.
> 
> Signed-off-by: Usama Arif <[email protected]>
> ---
>  include/linux/mmzone.h |  2 ++
>  mm/memcontrol.c        |  2 ++
>  mm/vmscan.c            | 14 +++++++++++++-
>  mm/vmstat.c            |  2 ++
>  4 files changed, 19 insertions(+), 1 deletion(-)
>

I do think the sashiko reviews in [1] about MGLRU are not correct.

I am going to ignore those unless the MGLRU maintainers think its an issue.

[1] https://sashiko.dev/#/patchset/20260727162550.2032-1-usama.arif%40linux.dev