RFC migrate_pages(): batch TLB flushing
Get series with b4
b4 am [email protected]Versions newest first
- v1 RFC Latest6 patches 43 repliesIn review
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/6 | mm/migrate_pages: separate huge page and normal pages migrationmm/ | +64 | 4 replies | |
| 2/6 | mm/migrate_pages: split unmap_and_move() to _unmap() and _move()mm/ | +122 | 20 replies | |
| 3/6 | mm/migrate_pages: restrict number of pages to migrate in batchmm/ | +67 | 3 replies | |
| 4/6 | mm/migrate_pages: batch _unmap and _movemm/ | +139 | 0 replies | |
| 5/6 | mm/migrate_pages: share more code between _unmap and _movemm/ | +100 | 0 replies | |
| 6/6 | mm/migrate_pages: batch flushing TLBmm/ mm/ | +23 | 0 replies |
Reviews trailers per patch
1 of 6 patches has a Reviewed-by or Acked-by.
| Patch | Baolin Wang |
|---|---|
| 1/6 | |
| 2/6 | R-b |
| 3/6 | |
| 4/6 | |
| 5/6 | |
| 6/6 |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [RFC 0/6] migrate_pages(): batch TLB flushing
From: "Huang, Ying" <[email protected]>
Now, migrate_pages() migrate pages one by one, like the fake code as follows,
for each page
unmap
flush TLB
copy
restore map
If multiple pages are passed to migrate_pages(), there are opportunities to batch the TLB flushing and copying. That is, we can change the code to something as follows,
for each page
unmap
for each page
flush TLB
for each page
copy
for each page
restore map
The total number of TLB flushing IPI can be reduced considerably. And we may use some hardware accelerator such as DSA to accelerate the page copying.
So in this patch, we refactor the migrate_pages() implementation and implement the TLB flushing batching. Base on this, hardware accelerated page copying can be implemented.
If too many pages are passed to migrate_pages(), in the naive batched implementation, we may unmap too many pages at the same time. The possibility for a task to wait for the migrated pages to be mapped again increases. So the latency may be hurt. To deal with this issue, the max number of pages be unmapped in batch is restricted to no more than HPAGE_PMD_NR. That is, the influence is at the same level of THP migration.
We use the following test to measure the performance impact of the patchset,
On a 2-socket Intel server,
- Run pmbench memory accessing benchmark
- Run migratepages to migrate pages of pmbench between node 0 and node 1 back and forth.
With the patch, the TLB flushing IPI reduces 99.1% during the test and the number of pages migrated successfully per second increases 291.7%.
This patchset is based on v6.0-rc5 and the following patchset,
[PATCH -V3 0/8] migrate_pages(): fix several bugs in error path
https://lore.kernel.org/lkml/[email protected]/
The migrate_pages() related code is converting to folio now. So this patchset cannot apply recent akpm/mm-unstable branch. This patchset is used to check the basic idea. If it is OK, I will rebase the patchset on top of folio changes.
Best Regards,
Huang, Ying