Re: [PATCH v5 3/5] mm/vmscan: extract pageout_one() from shrink_folio_list()
From: Barry Song
Date: Thu Aug 13 2026 - 17:50:02 EST
On Mon, Jul 20, 2026 at 1:08 PM Zhang Peng <zippermonkey@xxxxxxxxxx> wrote:
>
> shrink_folio_list() contains a self-contained pageout() dispatch state
> machine. Extract it into pageout_one() to reduce the size of
> shrink_folio_list() and make the pageout step independently readable.
>
> No functional change.
>
> Signed-off-by: Zhang Peng <bruzzhang@xxxxxxxxxxx>
> ---
[...]
> + if (!folio_try_pageout(folio, &free_folios, sc, stat,
> + &plug, folio_list, &nr_reclaimed))
> + goto keep;
Also, this patch looks basically good, just like the previous one.
Could we also avoid hiding the activation semantics in the inner
function? It would be clearer to make the activation semantics
explicit at the outer level, so readers don't have to dig into a
deep internal function to realize that a folio may take the
activation path.
In LRU, we have two distinct possibilities: activate a folio or just
keep it. This is an important semantic distinction in the LRU logic.
Hiding the activation decision so deep in an inner function makes
that semantic much less obvious.
> + continue;
> }
>
> if (!folio_try_reclaim_free(folio, &free_folios, sc, stat,
>
Best Regards
Barry