mm/migrate: add a flags parameter to migrate_vma

The src_owner field in struct migrate_vma is being used for two purposes,
it acts as a selection filter for which types of pages are to be migrated
and it identifies device private pages owned by the caller.

Split this into separate parameters so the src_owner field can be used
just to identify device private pages owned by the caller of
migrate_vma_setup().

Rename the src_owner field to pgmap_owner to reflect it is now used only
to identify which device private pages to migrate.

Link: https://lore.kernel.org/r/20200723223004.9586-3-rcampbell@nvidia.com
Signed-off-by: Ralph Campbell <rcampbell@nvidia.com>
Reviewed-by: Bharata B Rao <bharata@linux.ibm.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
This commit is contained in:
Ralph Campbell 2020-07-23 15:30:00 -07:00 committed by Jason Gunthorpe
parent 1a77decd0c
commit 5143192cd4
5 changed files with 23 additions and 19 deletions

View file

@ -180,6 +180,11 @@ static inline unsigned long migrate_pfn(unsigned long pfn)
return (pfn << MIGRATE_PFN_SHIFT) | MIGRATE_PFN_VALID;
}
enum migrate_vma_direction {
MIGRATE_VMA_SELECT_SYSTEM = 1 << 0,
MIGRATE_VMA_SELECT_DEVICE_PRIVATE = 1 << 1,
};
struct migrate_vma {
struct vm_area_struct *vma;
/*
@ -199,11 +204,11 @@ struct migrate_vma {
/*
* Set to the owner value also stored in page->pgmap->owner for
* migrating out of device private memory. If set only device
* private pages with this owner are migrated. If not set
* device private pages are not migrated at all.
* migrating out of device private memory. The flags also need to
* be set to MIGRATE_VMA_SELECT_DEVICE_PRIVATE.
*/
void *src_owner;
void *pgmap_owner;
unsigned long flags;
};
int migrate_vma_setup(struct migrate_vma *args);