Re: [PATCH v5 1/4] mm: swap: introduce swapcache_prepare_nr and swapcache_clear_nr for large folios swap-in

From: Baolin Wang
Date: Mon Jul 29 2024 - 23:00:19 EST


Hi Barry,

On 2024/7/26 17:46, Barry Song wrote:
From: Barry Song <v-songbaohua@xxxxxxxx>

Commit 13ddaf26be32 ("mm/swap: fix race when skipping swapcache") supports
one entry only, to support large folio swap-in, we need to handle multiple
swap entries.

To optimize stack usage, we iterate twice in __swap_duplicate_nr(): the
first time to verify that all entries are valid, and the second time to
apply the modifications to the entries.

Signed-off-by: Barry Song <v-songbaohua@xxxxxxxx>

LGTM. Feel free to add:
Reviewed-by: Baolin Wang <baolin.wang@xxxxxxxxxxxxxxxxx>

By the way, my shmem swap patchset[1] also relies on this patch, so I wonder if it's possible to merge this patch into the mm-unstable branch first (if other patches still need discussion), to make it easier for me to rebase and resend my patch set? Thanks.

[1] https://lore.kernel.org/all/cover.1720079976.git.baolin.wang@xxxxxxxxxxxxxxxxx/