Re: [PATCH v3 0/3] mm/rmap: batch the unmap of large folios during migration

From: Ravi Jonnalagadda

Date: Mon Nov 30 2026 - 15:02:43 EST


On Thu, 26 Nov 2026 09:53:00 +0000, Shivank Garg wrote:
> This series lets try_to_migrate_one() convert a batch of consecutive PTEs
> that map the same large folio in one go, mirroring what
> try_to_unmap_one() already does, with some refactoring on the way.

Hi Shivank,

I tested v3 on an AMD EPYC system, migrating between DRAM and CXL
memory. The gains have the shape of your Zen5 table.

How I tested
------------
- An AMD EPYC system with DRAM and a CXL Type 3 memory expander,
booted with mitigations=off as in your runs.
- Base kernel: your base, mm-core for-next 518cbccb58e4 with Dev's
v5 [1]. Each result compares it without and with v3.
- move_pages() of 1 GiB of anonymous memory, one mTHP size at a time,
between DRAM and CXL in both directions.
- GB/s = 1 GiB / wall time of the move_pages() call. Every word is
checked after each move.

What I saw
----------
On the base kernel:

folio | without v3 | with v3 | gain | try_to_migrate() ms
------+------------+------------+---------+--------------------
4K | 4.77 GB/s | 4.81 GB/s | +0.9 % | 42.5 -> 41.6
16K | 7.28 GB/s | 8.36 GB/s | +14.8 % | 35.2 -> 19.4
64K | 9.18 GB/s | 11.18 GB/s | +21.9 % | 34.4 -> 15.3
256K | 9.66 GB/s | 13.22 GB/s | +36.9 % | 36.1 -> 6.4
1M | 10.15 GB/s | 13.54 GB/s | +33.5 % | 32.9 -> 6.0
2M | 17.61 GB/s | 17.30 GB/s | -1.7 % | 0.33 -> 0.32

- try_to_migrate() time drops the same way as in your profile.
- 2M is PMD-mapped and unchanged within noise.

With the copy offloaded to DMA, the batching matters more, as your v2
cover expected. For this I used an offload kernel: the base kernel
plus your offload series v6, with dcbm holding its DMA channels while
offloading is enabled (results in [2], code in [3]), on an AMD SDXI
engine. On the offload kernel, CPU copy and DMA copy, each without
and with v3:

folio | copy | without v3 | with v3 | gain
------+------+------------+------------+--------
256K | CPU | 9.73 GB/s | 12.31 GB/s | +26.5 %
256K | DMA | 15.53 GB/s | 23.83 GB/s | +53.5 %
1M | CPU | 10.08 GB/s | 12.66 GB/s | +25.5 %
1M | DMA | 16.21 GB/s | 25.54 GB/s | +57.6 %

The offload kernel moves the whole 1 GiB in one batch (v6 5/5), so
its CPU numbers are not comparable with the base kernel's table.

Tested-by: Ravi Jonnalagadda <ravis.opensrc@xxxxxxxxx>

Thanks,
Ravi

[1] https://lore.kernel.org/linux-mm/20261123053543.295467-1-dev.jain@xxxxxxx/
[2] https://lore.kernel.org/all/20261128224616.66122-1-ravis.opensrc@xxxxxxxxx/
[3] https://lore.kernel.org/all/20261128225943.66318-1-ravis.opensrc@xxxxxxxxx/