[PATCH v5 35/38] mm: avoid use of VMA_SPECIAL_FLAGS in migrate_vma_setup()

David Hildenbrand (Arm) david at kernel.org
Mon Oct 12 11:52:07 PDT 2026


On 10/9/26 20:04, Lorenzo Stoakes (ARM) wrote:
> Now we have the expressive vma_is_mm_managed() and vma_is_fixed_mapping()
> predicates, use them to determine whether to proceed with migration. This
> drops the VMA_IO_BIT test, which is safe as mm-managed mappings may not set
> it.
> 
> hugetlb mappings remain excluded, as they are fixed mappings.
> 
> No functional change intended.
> 
> Reviewed-by: Zi Yan <ziy at nvidia.com>
> Acked-by: David Hildenbrand (Arm) <david at kernel.org>
> Signed-off-by: Lorenzo Stoakes (ARM) <ljs at kernel.org>
> ---
>  mm/migrate_device.c | 12 +++++++-----
>  1 file changed, 7 insertions(+), 5 deletions(-)
> 
> diff --git a/mm/migrate_device.c b/mm/migrate_device.c
> index b9c453c28795..289d7b08ace4 100644
> --- a/mm/migrate_device.c
> +++ b/mm/migrate_device.c
> @@ -739,19 +739,21 @@ static void migrate_vma_unmap(struct migrate_vma *migrate)
>   */
>  int migrate_vma_setup(struct migrate_vma *args)
>  {
> +	const struct vm_area_struct *vma = args->vma;
>  	long nr_pages = (args->end - args->start) >> PAGE_SHIFT;
>  
>  	args->start &= PAGE_MASK;
>  	args->end &= PAGE_MASK;
> -	if (!args->vma || vma_test_any_mask(args->vma, VMA_SPECIAL_FLAGS) ||
> -	    vma_is_dax(args->vma))
> +	if (!vma)
> +		return -EINVAL;
> +	if (!vma_is_mm_managed(vma) || vma_is_fixed_mapping(vma) ||
> +	    vma_is_dax(vma))

Same here, with the droppable thing changed this would be

!vma_is_mm_backed() || vma_is_dax(vma)

I guess.

Acked-by: David Hildenbrand (Arm) <david at kernel.org>

-- 
Cheers,

David



More information about the kvm-riscv mailing list