Re: [PATCH 1/3] mm/mglru: improve readability of isolate_folios()
Baolin Wang <[email protected]>
| Newsgroups | org.kvack.linux-mm,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <[email protected]> |
On 8/20/26 12:56 PM, Barry Song (Xiaomi) wrote: > From: Ridong Chen <[email protected]> > > 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 <[email protected]> > Co-developed-by: Barry Song (Xiaomi) <[email protected]> > Signed-off-by: Barry Song (Xiaomi) <[email protected]> > --- LGTM. Reviewed-by: Baolin Wang <[email protected]> > 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 :)