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 <hch@lst.de>
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 <hch@lst.de>
    Reviewed-by: Alistair Popple <apopple@nvidia.com>
    Tested-by: "Sierra Guiza, Alejandro (Alex)" <alex.sierra@amd.com>

    Cc: Alex Deucher <alexander.deucher@amd.com>
    Cc: Ben Skeggs <bskeggs@redhat.com>
    Cc: Chaitanya Kulkarni <kch@nvidia.com>
    Cc: Christian Knig <christian.koenig@amd.com>
    Cc: Dan Williams <dan.j.williams@intel.com>
    Cc: Felix Kuehling <Felix.Kuehling@amd.com>
    Cc: Jason Gunthorpe <jgg@nvidia.com>
    Cc: Karol Herbst <kherbst@redhat.com>
    Cc: Logan Gunthorpe <logang@deltatee.com>
    Cc: Lyude Paul <lyude@redhat.com>
    Cc: Miaohe Lin <linmiaohe@huawei.com>
    Cc: Muchun Song <songmuchun@bytedance.com>
    Cc: "Pan, Xinhui" <Xinhui.Pan@amd.com>
    Cc: Ralph Campbell <rcampbell@nvidia.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>

Signed-off-by: Chris von Recklinghausen <crecklin@redhat.com>
This commit is contained in:
Chris von Recklinghausen 2022-10-12 07:09:00 -04:00
parent af1b8a016a
commit 19855bbeb7
1 changed files with 12 additions and 15 deletions

View File

@ -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);