Re: [PATCH v5 2/3] mm/vmscan: add pgrotate_anon and pgrotate_file vmstat counters
From: Johannes Weiner
Date: Mon Jul 27 2026 - 13:31:12 EST
On Mon, Jul 27, 2026 at 09:23:24AM -0700, Usama Arif 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 <usama.arif@xxxxxxxxx>
Acked-by: Johannes Weiner <hannes@xxxxxxxxxxx>