[RFC PATCH v4 12/16] mm/mglru: run aging if the preferred type has no reclaimable gens

From: Barry Song (Xiaomi)

Date: Wed Aug 12 2026 - 09:20:28 EST


Respect the type selected by get_type_to_scan(). If there are no
reclaimable gens left for that type, run aging.

Signed-off-by: Barry Song (Xiaomi) <baohua@xxxxxxxxxx>
---
mm/vmscan.c | 5 +++++
1 file changed, 5 insertions(+)

diff --git a/mm/vmscan.c b/mm/vmscan.c
index 48a068b50678..50f0bcf9576c 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -5095,12 +5095,17 @@ static int evict_folios(unsigned long nr_to_scan, struct lruvec *lruvec,
static bool should_run_aging(struct lruvec *lruvec, unsigned long max_seq,
struct scan_control *sc, int swappiness)
{
+ int type = get_type_to_scan(lruvec, swappiness);
DEFINE_MIN_SEQ(lruvec);

/* have to run aging, since eviction is not possible anymore */
if (evictable_min_seq(min_seq, swappiness) + MIN_NR_GENS > max_seq)
return true;

+ /* run aging if the preferred type is exhausted */
+ if (min_seq[type] + MIN_NR_GENS > max_seq)
+ return true;
+
/*
* Try to avoid aging by doing gentle reclaim at the default
* priority. Skip gentle reclaim for extreme swappiness.
--
2.34.1