mm/migrate_device: Try to handle swapcache pages
Subsystems (2)
PATCH v4 1/1 mm/migrate_device: Try to handle swapcache pages
From: Mika Penttilä <[email protected]>
Migrating file pages and swapcache pages into device memory is not supported. Try to get rid of the swap cache, and if successful, go ahead as with other anonymous pages.
Cc Alistair Popple <[email protected]>
Cc John Hubbard <[email protected]>
Cc Ralph Campbell <[email protected]>
Cc "Huang, Ying" <[email protected]>
Reviewed-by "Huang, Ying" <[email protected]>
Reviewed-by Alistair Popple <[email protected]>
Signed-off-by Mika Penttilä <[email protected]>
---
v4:
- fix commit log message
- delete empty line
v3:
- adjust comments
- add Reviewed-bys
v2:
- use folio_test_anon() (Huang, Ying)
mm/migrate_device.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-)
mm/migrate_device.c +15 -6
@@ -747,13 +747,22 @@ static void __migrate_device_pages(unsigned long *src_pfns,if (is_device_private_page (newpage) ||is_device_coherent_page (newpage)) { -/* -* For now only support anonymous memory migrating to -* device private or coherent memory. -*/ if (mapping) { - src_pfns[i] &= ~MIGRATE_PFN_MIGRATE ; -continue ; +struct folio *folio; + + folio =page_folio (page); + +/* +* For now only support anonymous memory migrating to +* device private or coherent memory. +* +* Try to get rid of swap cache if possible. +*/ +if (!folio_test_anon (folio) || + !folio_free_swap (folio)) { + src_pfns[i] &= ~MIGRATE_PFN_MIGRATE ; +continue ; + } } }else if (is_zone_device_page (newpage)) {/*
Signature · 1 line
2.17.1