mm-mglru-make-type-fallback-logic-explicit-in-isolate_folios.patch removed from -mm tree
The quilt patch titled
Subject: mm/mglru: make type fallback logic explicit in isolate_folios()
has been removed from the -mm tree. Its filename was
mm-mglru-make-type-fallback-logic-explicit-in-isolate_folios.patch
This patch was dropped because it was merged into the mm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
------------------------------------------------------
From: Ridong Chen <[email protected]>
Subject: mm/mglru: make type fallback logic explicit in isolate_folios()
Date: Sat, 29 Aug 2026 15:42:03 +0800
Patch series "mm/mglru: clean up isolate_folios for readability and clarity", v2.
Right now, isolate_folios() is quite difficult to follow:
1. It uses for_each_evictable_type(i, swappiness) to iterate over the types, but 'i' is not actually used as the type within the loop body.
2. It retries the same type when folios were scanned but none could be isolated, but the retry is implemented in a rather subtle way that is difficult to understand.
This patchset makes both behaviors explicit and much easier to follow.
There are no functional changes for swappiness values from 1 to 200. There is a slight functional change for 0 and 201: with the existing code, there is no chance to retry for these values because for_each_evictable_type() only iterates once. After this patch, 0 and 201 have behavior that is more consistent with the 1-200 range.
This patch (of 2):
The for_each_evictable_type() loop in isolate_folios() is misleading: it does not actually iterate over each evictable type. Instead, get_type_to_scan() selects the type to scan, while the iterator i merely bounds the number of attempts.
Make the fallback behavior explicit in the code and remove the opaque for_each_evictable_type(i, swappiness).
---
mm/vmscan.c | 50 ++++++++++++++++++++++++++++---------------------- 1 file changed, 28 insertions(+), 22 deletions(-)
mm/vmscan.c renamed from mm/vmscan.c~mm-mglru-make-type-fallback-logic-explicit-in-isolate_folios +28 -22
@@ -4826,35 +4826,41 @@ static int get_type_to_scan(struct lruvereturn positive_ctrl_err (&sp, &pv); } +static inline bool is_single_type_reclaim (int swappiness) +{ +return swappiness ==MIN_SWAPPINESS || + swappiness ==SWAPPINESS_ANON_ONLY ; +} +static int isolate_folios (unsigned long nr_to_scan,struct lruvec *lruvec,struct scan_control *sc,int swappiness,struct list_head *list,int *isolated,int *isolate_type,int *isolate_scanned) { -int i; -int total_scanned =0 ; +bool type_fallback_allowed = !is_single_type_reclaim (swappiness);int type =get_type_to_scan (lruvec, swappiness); +int total_scanned =0 , scanned, tier; + +retry: + tier =get_tier_idx (lruvec, type); + scanned =scan_folios (nr_to_scan, lruvec, sc, + type, tier, list, isolated); + + total_scanned += scanned; +if (*isolated) { + *isolate_type = type; + *isolate_scanned = scanned; +return total_scanned; + } -for_each_evictable_type (i, swappiness) { -int scanned; -int tier =get_tier_idx (lruvec, type); - - scanned =scan_folios (nr_to_scan, lruvec, sc, - type, tier, list, isolated); - - total_scanned += scanned; -if (*isolated) { - *isolate_type = type; - *isolate_scanned = scanned; -break ; - } -/* -* 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. -*/ -if (!scanned) - type = !type; +/* +* We are running out of the current reclaim type. Fall back to +* the other type if allowed. +*/ +if (!scanned && type_fallback_allowed) { + type = !type; + type_fallback_allowed = false; + goto retry; }return total_scanned;
_
Patches currently in -mm which might be from [email protected] are
mm-page_counter-avoid-integer-overflow-in-effective_protection.patch mm-mglru-fix-ineffective-memory-protection-for-non-kswapd-reclaim.patch mm-vmscan-put-rotation-missed-folios-at-the-lru-tail.patch