From: Zhaoyang Huang <zhaoyang.huang@xxxxxxxxxx> Unlike legacy LRU management, MGLRU will switch to other zones or types when current lrugen[gen][type][zone] scanning failed, which means skipped folios could become available in next scan. This commit would like to suggest to keep the LRU's order by moving unisolated folios to the tail of LRU during the first 2 round scan to avoid potential livelock on the unisolated ones. Signed-off-by: Zhaoyang Huang <zhaoyang.huang@xxxxxxxxxx> --- mm/vmscan.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mm/vmscan.c b/mm/vmscan.c index 2e34de9cd0d4..cd1f38bb1d45 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -4397,7 +4397,10 @@ static int scan_folios(struct lruvec *lruvec, struct scan_control *sc, } if (skipped_zone) { - list_splice(&moved, head); + if (sc->priority > DEF_PRIORITY - 2) + list_splice_tail(&moved, head); + else + list_splice(&moved, head); __count_zid_vm_events(PGSCAN_SKIP, zone, skipped_zone); skipped += skipped_zone; } -- 2.25.1