Re: [PATCH v2 1/3] mm/mglru: factor out lru_gen_seq_nr_pages()

From: Baolin Wang

Date: Mon Sep 14 2026 - 03:09:42 EST




On 9/11/26 6:29 PM, Ridong Chen wrote:
From: Ridong Chen <chenridong@xxxxxxxxxx>

Both lruvec_evictable_size() and the debugfs lru_gen_seq_show() compute
the number of pages in a generation the same way: sum lrugen->nr_pages
over all zones for a given (gen, type) and clamp each term to >= 0.

Factor that out into lru_gen_seq_nr_pages() so the open-coded zone loop
lives in one place. No functional change.

A follow-up patch adds a tracepoint that needs the same per-generation
page count, and will reuse this helper instead of open-coding it again.

Assisted-by: Claude:claude-opus-4-8
Signed-off-by: Ridong Chen <chenridong@xxxxxxxxxx>
---

LGTM.
Reviewed-by: Baolin Wang <baolin.wang@xxxxxxxxxxxxxxxxx>