Re: [RFC PATCH] mm: vmscan: avoid anon scanning for GFP_NOIO with low swapcache in MGLRU
From: Xiang Liu
Date: Mon Oct 12 2026 - 04:26:25 EST
Hi Barry,
Thanks for reviewing.
> I'm not a fan of this fix, as setting
> scan_swappiness = MIN_SWAPPINESS will force a cold/hot
> inversion for anonymous folios.
The patch description outlines the tradeoff:
> The tradeoff is synchronous aging. With four anon generations and two
> file generations, advancing max_seq can require moving the oldest anon
> folios to the next generation. This patch accepts that cost to avoid
> low-yield anonymous scanning. It keeps the original swappiness in
> try_to_inc_max_seq(), avoiding additional use of the inc_min_seq()
> single-type shortcut that advances min_seq without processing the
> oldest folios and can cause cold/hot inversions.
To evaluate this tradeoff, we varied the oldest anon population and
compared synchronous aging with baseline evict_folios() time under
GFP_NOIO with very little swapcache. In the cases reported in the patch,
aging was substantially cheaper than low-yield anon eviction, and
allocation and reclaim times decreased. This motivated retaining the
synchronous cost while avoiding additional use of the existing
cold/hot-inversion shortcut.
The diff uses scan_swappiness to decide whether aging is needed, and
passes the original swappiness to try_to_inc_max_seq():
if (should_run_aging(lruvec, max_seq, sc, scan_swappiness)) {
if (try_to_inc_max_seq(lruvec, max_seq, swappiness, false))
need_rotate = true;
should_age = true;
}
inc_min_seq() receives the original swappiness through inc_max_seq().
With a nonzero original value, the anon shortcut is bypassed. When anon
has four generations, its oldest folios are processed before max_seq
advances, retaining the synchronous cost described above.
Am I missing another path where this change would trigger the shortcut?
Best regards,
Xiang