Respect the type selected by positive_ctrl_err(). If there are no reclaimable generations left for that type, run aging. For balanced swappiness values near the middle, still allow gentle reclaim since the swappiness bias is less of a concern, while the slightly increased aging overhead might become a problem. Signed-off-by: Barry Song (Xiaomi) --- mm/vmscan.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/mm/vmscan.c b/mm/vmscan.c index 98fd2fac90ac..902d85afc5f6 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -5035,6 +5035,10 @@ static bool should_run_aging(struct lruvec *lruvec, unsigned long max_seq, if (evictable_min_seq(min_seq, swappiness) + MIN_NR_GENS > max_seq) return true; + /* run aging if the preferred type is exhausted for extreme swappiness */ + if (min_seq[type] + MIN_NR_GENS > max_seq && !swappiness_is_balanced(swappiness)) + return true; + /* try to avoid aging, do gentle reclaim at the default priority */ if (sc->priority == DEF_PRIORITY) return false; -- 2.34.1