[RFC PATCH v4 13/16] mm/mglru: remove redundant gens <= MIN_NR_GENS check in should_run_aging()

From: Barry Song (Xiaomi)

Date: Wed Aug 12 2026 - 08:27:53 EST


From: Bo Zhang <zhangbo56@xxxxxxxxxx>

If the following condition is true,

if (min_seq[type] + MIN_NR_GENS > max_seq)
return true;

then this one must also be true,

if (evictable_min_seq(min_seq, swappiness) + MIN_NR_GENS > max_seq)
return true;

The converse is not true, so the evictable_min_seq() check is
redundant and can be removed.

Signed-off-by: Bo Zhang <zhangbo56@xxxxxxxxxx>
Signed-off-by: Barry Song (Xiaomi) <baohua@xxxxxxxxxx>
---
mm/vmscan.c | 4 ----
1 file changed, 4 deletions(-)

diff --git a/mm/vmscan.c b/mm/vmscan.c
index 50f0bcf9576c..a276560bc66b 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -5098,10 +5098,6 @@ static bool should_run_aging(struct lruvec *lruvec, unsigned long max_seq,
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;
--
2.34.1