mirror of
https://github.com/torvalds/linux.git
synced 2026-09-22 12:44:03 +02:00
mm/migrate_device: try to handle swapcache pages
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. Link: https://lkml.kernel.org/r/20230607172944.11713-1-mpenttil@redhat.com Signed-off-by: Mika Penttilä <mpenttil@redhat.com> Reviewed-by: "Huang, Ying" <ying.huang@intel.com> Reviewed-by: Alistair Popple <apopple@nvidia.com> Cc: John Hubbard <jhubbard@nvidia.com> Cc: Ralph Campbell <rcampbell@nvidia.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
This commit is contained in:
parent
d9cfaf405b
commit
df263d9a7d
|
|
@ -727,14 +727,23 @@ static void __migrate_device_pages(unsigned long *src_pfns,
|
||||||
|
|
||||||
if (is_device_private_page(newpage) ||
|
if (is_device_private_page(newpage) ||
|
||||||
is_device_coherent_page(newpage)) {
|
is_device_coherent_page(newpage)) {
|
||||||
|
if (mapping) {
|
||||||
|
struct folio *folio;
|
||||||
|
|
||||||
|
folio = page_folio(page);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* For now only support anonymous memory migrating to
|
* For now only support anonymous memory migrating to
|
||||||
* device private or coherent memory.
|
* device private or coherent memory.
|
||||||
|
*
|
||||||
|
* Try to get rid of swap cache if possible.
|
||||||
*/
|
*/
|
||||||
if (mapping) {
|
if (!folio_test_anon(folio) ||
|
||||||
|
!folio_free_swap(folio)) {
|
||||||
src_pfns[i] &= ~MIGRATE_PFN_MIGRATE;
|
src_pfns[i] &= ~MIGRATE_PFN_MIGRATE;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else if (is_zone_device_page(newpage)) {
|
} else if (is_zone_device_page(newpage)) {
|
||||||
/*
|
/*
|
||||||
* Other types of ZONE_DEVICE page are not supported.
|
* Other types of ZONE_DEVICE page are not supported.
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user