Re: [PATCH v4 07/12] mm/swapfile: Add batched version of folio_dup_swap

From: David Hildenbrand (Arm)

Date: Tue Jun 16 2026 - 09:55:25 EST


On 5/26/26 08:36, Dev Jain wrote:
> Add folio_dup_swap_pages to handle a batch of consecutive pages. Note
> that folio_dup_swap already can handle a subset of this: nr_pages == 1 and
> nr_pages == folio_nr_pages(folio). Generalize this to any nr_pages.
>
> Currently we have a not-so-nice logic of passing in subpage == NULL if
> we mean to exercise the logic on the entire folio, and subpage != NULL if
> we want to exercise the logic on only that subpage. Remove this
> indirection: the caller invokes folio_dup_swap_pages() if it wants to
> operate on a range of pages in the folio (i.e nr_pages may be anything
> between 1 till folio_nr_pages()), and invokes folio_dup_swap() if it
> wants to operate on the entire folio.
>
> Signed-off-by: Dev Jain <dev.jain@xxxxxxx>
> ---

I was briefly wondering whether "folio_dup_swap_range()" would be better (a
folio range), but *_pages() works for me as well.

Acked-by: David Hildenbrand (Arm) <david@xxxxxxxxxx>

--
Cheers,

David