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

From: David Hildenbrand (Arm)

Date: Wed Jun 17 2026 - 08:25:27 EST


On 5/25/26 16:57, Zhang Peng 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>
> ---
> mm/vmscan.c | 107 ++++++++++++++++++++++++++++++++++++------------------------
> 1 file changed, 65 insertions(+), 42 deletions(-)
>
> diff --git a/mm/vmscan.c b/mm/vmscan.c
> index b31f67801836..456d38eb172c 100644
> --- a/mm/vmscan.c
> +++ b/mm/vmscan.c
> @@ -1161,8 +1161,68 @@ static bool folio_free(struct folio *folio, struct folio_batch *free_folios,
> return true;
> }
>
> +static bool pageout_one(struct folio *folio,
> + struct folio_batch *free_folios,
> + struct scan_control *sc, struct reclaim_stat *stat,
> + struct swap_iocb **plug, struct list_head *folio_list,
> + unsigned int *nr_reclaimed)

Two tabs please.

Same comment regarding returning a bool.

> +{
> + struct address_space *mapping = folio_mapping(folio);
> + unsigned int nr_pages = folio_nr_pages(folio);

Can both be const I assume.

> +
> + switch (pageout(folio, mapping, plug, folio_list)) {
> + case PAGE_ACTIVATE:
> + /*
> + * If shmem folio is split when writeback to swap,
> + * the tail pages will make their own pass through
> + * this function and be accounted then.
> + */

Same comment regarding making these comments use less LOC.


In general, LGTM.


--
Cheers,

David