[RFC PATCH 1/4] mm: mglru: only fall back when reclaim is running at high priority

From: Barry Song (Xiaomi)

Date: Sat Jul 25 2026 - 21:30:22 EST


Respect the type selected by positive_ctrl_err(), where swappiness
controls the relative weights of SP and PV. Falling back too readily
violates that bias.

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

diff --git a/mm/vmscan.c b/mm/vmscan.c
index 566c4e837c7d..f79402760776 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -4855,9 +4855,12 @@ static int isolate_folios(unsigned long nr_to_scan, struct lruvec *lruvec,
* If scanned > 0 and isolated == 0, avoid falling back to the
* other type, as this type remains sufficient. Falling back
* too readily can disrupt the positive_ctrl_err() bias.
+ * Only fall back when reclaim is running at high priority.
*/
- if (!scanned)
- type = !type;
+ if (!scanned) {
+ if (!sc->priority)
+ type = !type;
+ }
}

return total_scanned;
--
2.39.3 (Apple Git-146)