From: Christoph Hellwig Date: Wed, 16 Feb 2022 04:31:37 +0000 (+1100) Subject: mm: refactor the ZONE_DEVICE handling in migrate_vma_pages X-Git-Tag: v6.6.17~7962^2~88 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=aaf7d70cc595c78d27e915451e93a4459cfc36f3;p=platform%2Fkernel%2Flinux-rpi.git 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) --- diff --git a/mm/migrate.c b/mm/migrate.c index 4246dca..7dffd5f 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -2792,24 +2792,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);