[RFC PATCH v4 08/16] mm/mglru: exclude folios promoted by aging from protected in inc_min_seq()
From: Barry Song (Xiaomi)
Date: Wed Aug 12 2026 - 08:26:47 EST
Some folios may have been promoted during aging, so don't count them
as protected, similar to sort_folio().
Signed-off-by: Barry Song (Xiaomi) <baohua@xxxxxxxxxx>
---
mm/vmscan.c | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/mm/vmscan.c b/mm/vmscan.c
index e0625e6ec919..27623d3bad95 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -3948,16 +3948,15 @@ static bool inc_min_seq(struct lruvec *lruvec, int type, int swappiness)
if (gen_increased) {
delta += nr_pages;
list_move_tail(&folio->lru, &lrugen->folios[new_gen][type][zone]);
+ /* don't count the workingset being lazily promoted */
+ if (refs + workingset != BIT(LRU_REFS_WIDTH) + 1) {
+ int tier = lru_tier_from_refs(refs, workingset);
+
+ protected[tier] += nr_pages;
+ }
} else {
list_move(&folio->lru, &lrugen->folios[new_gen][type][zone]);
}
- /* don't count the workingset being lazily promoted */
- if (refs + workingset != BIT(LRU_REFS_WIDTH) + 1) {
- int tier = lru_tier_from_refs(refs, workingset);
-
- protected[tier] += nr_pages;
- }
-
if (!--remaining)
break;
}
--
2.34.1