[RFC PATCH v2 2/5] mm: mglru: only fall back when reclaim is running at high priority
From: Barry Song (Xiaomi)
Date: Sun Jul 26 2026 - 08:22:29 EST
Respect the type selected by positive_ctrl_err(), where swappiness
controls the relative weights of SP and PV. Falling back too readily
undermines that bias. Only fall back after making a sufficient effort
to reclaim from the preferred type.
Signed-off-by: Barry Song (Xiaomi) <baohua@xxxxxxxxxx>
---
mm/vmscan.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/mm/vmscan.c b/mm/vmscan.c
index babbce4bbfe8..4a387cc4145a 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -4857,10 +4857,14 @@ static int isolate_folios(unsigned long nr_to_scan, struct lruvec *lruvec,
* type is still reclaimable; otherwise, it would have
* already run out of reclaimable generations. Falling
* back too readily can disrupt the positive_ctrl_err()
- * bias.
+ * bias. Also, only fall back when reclaim is running at
+ * a high priority.
*/
- if (scanned < nr_to_scan && *isolated < MIN_LRU_BATCH)
+ if (scanned < nr_to_scan && *isolated < MIN_LRU_BATCH) {
+ if (sc->priority > 2)
+ break;
type = !type;
+ }
}
return total_scanned;
--
2.39.3 (Apple Git-146)