From 19855bbeb7d53b0eaf69df5b32bde838f5a7e31b Mon Sep 17 00:00:00 2001 From: Chris von Recklinghausen Date: Wed, 12 Oct 2022 07:09:00 -0400 Subject: [PATCH] mm: refactor the ZONE_DEVICE handling in migrate_vma_pages Bugzilla: https://bugzilla.redhat.com/2120352 Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2099722 commit aaf7d70cc595c78d27e915451e93a4459cfc36f3 Author: Christoph Hellwig Date: Wed Feb 16 15:31:37 2022 +1100 mm: refactor the ZONE_DEVICE handling in migrate_vma_pages Make the flow a little more clear and prepare for adding a new ZONE_DEVICE memory type. Link: https://lkml.kernel.org/r/20220210072828.2930359-13-hch@lst.de Signed-off-by: Christoph Hellwig Reviewed-by: Alistair Popple Tested-by: "Sierra Guiza, Alejandro (Alex)" Cc: Alex Deucher Cc: Ben Skeggs Cc: Chaitanya Kulkarni Cc: Christian Knig Cc: Dan Williams Cc: Felix Kuehling Cc: Jason Gunthorpe Cc: Karol Herbst Cc: Logan Gunthorpe Cc: Lyude Paul Cc: Miaohe Lin Cc: Muchun Song Cc: "Pan, Xinhui" Cc: Ralph Campbell Signed-off-by: Andrew Morton Signed-off-by: Matthew Wilcox (Oracle) Signed-off-by: Chris von Recklinghausen --- mm/migrate.c | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/mm/migrate.c b/mm/migrate.c index 214c0c11f9ae..08e6b8ee3854 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -2769,24 +2769,21 @@ void migrate_vma_pages(struct migrate_vma *migrate) mapping = page_mapping(page); - if (is_zone_device_page(newpage)) { - if (is_device_private_page(newpage)) { - /* - * For now only support private anonymous when - * migrating to un-addressable device memory. - */ - if (mapping) { - migrate->src[i] &= ~MIGRATE_PFN_MIGRATE; - continue; - } - } else { - /* - * Other types of ZONE_DEVICE page are not - * supported. - */ + if (is_device_private_page(newpage)) { + /* + * For now only support private anonymous when migrating + * to un-addressable device memory. + */ + if (mapping) { migrate->src[i] &= ~MIGRATE_PFN_MIGRATE; continue; } + } else if (is_zone_device_page(newpage)) { + /* + * Other types of ZONE_DEVICE page are not supported. + */ + migrate->src[i] &= ~MIGRATE_PFN_MIGRATE; + continue; } r = migrate_page(mapping, newpage, page, MIGRATE_SYNC_NO_COPY);