[PATCH 0/3] mm/migrate: batch PTE restoration for large folios

From: Wandun Chen

Date: Thu Nov 19 2026 - 22:30:04 EST


From: Wandun Chen <chenwandun@xxxxxxxxxxx>

remove_migration_pte() restores PTE-mapped large folios one PTE at a
time, constructing each new PTE and updating the folio references and
rmap separately.

Following David Hildenbrand's suggestion [1], this series batches
adjacent migration entries with consecutive PFNs and matching type
and flags. When a batch restores the whole folio in an mlocked VMA,
the rmap helpers automatically mark the folio as mlocked. It also
extends pte-batching to device-private folios.

The series applies on top of the mlock tracking fix for PTE-mapped
large-folio migration [2].

[1] https://lore.kernel.org/lkml/5f9c449e-43b3-4732-9c14-8199418cace0@xxxxxxxxxx/
[2] https://lore.kernel.org/lkml/20261113083927.2727599-1-chenwandun1@xxxxxxxxx/

Wandun Chen (3):
mm: factor out common softleaf offset PTE batch scanning
mm/migrate: batch PTE restoration in remove_migration_pte()
mm/migrate: batch PTE restoration for device-private folios

mm/internal.h | 28 ++++++++++++++++++++--------
mm/migrate.c | 51 +++++++++++++++++++++++++++++++++++++++++++++------
2 files changed, 65 insertions(+), 14 deletions(-)

--
2.43.0