Re: [PATCH v5 3/5] mm/vmscan: extract pageout_one() from shrink_folio_list()

Barry Song <[email protected]>
Newsgroups gmane.linux.kernel,gmane.linux.kernel.mm
Message-ID <CAGsJ_4zOfR3Rn5tk_RcOWUDmREO1JyRwXA15Vr3aeUs=+ybMMA@mail.gmail.com>
On Mon, Jul 20, 2026 at 1:08 PM Zhang Peng <[email protected]> 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 <[email protected]>
> ---
[...]
> +                       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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.