Re: [PATCH 1/3] mm/mglru: improve readability of isolate_folios()

From: Baolin Wang

Date: Thu Aug 20 2026 - 05:03:19 EST




On 8/20/26 12:56 PM, Barry Song (Xiaomi) wrote:
From: Ridong Chen <chenridong@xxxxxxxxxx>

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).

Signed-off-by: Ridong Chen <chenridong@xxxxxxxxxx>
Co-developed-by: Barry Song (Xiaomi) <baohua@xxxxxxxxxx>
Signed-off-by: Barry Song (Xiaomi) <baohua@xxxxxxxxxx>
---

LGTM.
Reviewed-by: Baolin Wang <baolin.wang@xxxxxxxxxxxxxxxxx>

mm/vmscan.c | 46 ++++++++++++++++++++++++++--------------------
1 file changed, 26 insertions(+), 20 deletions(-)

diff --git a/mm/vmscan.c b/mm/vmscan.c
index c1404a59523d..d5cc30b667ad 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -4833,35 +4833,41 @@ static int get_type_to_scan(struct lruvec *lruvec, int swappiness)
return positive_ctrl_err(&sp, &pv);
}
+static inline bool is_single_type_reclaim(int swappiness)
+{
+ return swappiness == MIN_SWAPPINESS ||
+ swappiness == SWAPPINESS_ANON_ONLY;
+}

I can't think of a better function name either, so I'm fine with it :)