Re: [PATCH v3 2/5] mm/migrate: add a flags parameter to migrate_vma

From: Bharata B Rao
Date: Wed Jul 22 2020 - 07:51:33 EST


On Tue, Jul 21, 2020 at 02:31:16PM -0700, Ralph Campbell wrote:
> 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.
>
> Signed-off-by: Ralph Campbell <rcampbell@xxxxxxxxxx>
> ---
> arch/powerpc/kvm/book3s_hv_uvmem.c | 4 +++-
> drivers/gpu/drm/nouveau/nouveau_dmem.c | 4 +++-
> include/linux/migrate.h | 13 +++++++++----
> lib/test_hmm.c | 6 ++++--
> mm/migrate.c | 6 ++++--
> 5 files changed, 23 insertions(+), 10 deletions(-)
>
> diff --git a/arch/powerpc/kvm/book3s_hv_uvmem.c b/arch/powerpc/kvm/book3s_hv_uvmem.c
> index 09d8119024db..6850bd04bcb9 100644
> --- a/arch/powerpc/kvm/book3s_hv_uvmem.c
> +++ b/arch/powerpc/kvm/book3s_hv_uvmem.c
> @@ -400,6 +400,7 @@ kvmppc_svm_page_in(struct vm_area_struct *vma, unsigned long start,
> mig.end = end;
> mig.src = &src_pfn;
> mig.dst = &dst_pfn;
> + mig.flags = MIGRATE_VMA_SELECT_SYSTEM;
>
> /*
> * We come here with mmap_lock write lock held just for
> @@ -577,7 +578,8 @@ kvmppc_svm_page_out(struct vm_area_struct *vma, unsigned long start,
> mig.end = end;
> mig.src = &src_pfn;
> mig.dst = &dst_pfn;
> - mig.src_owner = &kvmppc_uvmem_pgmap;
> + mig.pgmap_owner = &kvmppc_uvmem_pgmap;
> + mig.flags = MIGRATE_VMA_SELECT_DEVICE_PRIVATE;
>
> mutex_lock(&kvm->arch.uvmem_lock);

For the kvmppc changes above,
Reviewed-by: Bharata B Rao <bharata@xxxxxxxxxxxxx>