mm: avoid use of VMA_SPECIAL_FLAGS in migrate_vma_setup()

Now we have the expressive vma_is_mm_backed() predicate, use it 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 are mm-backed but remain explicitly excluded, as the
migrate_vma page walk has no hugetlb support.

No functional change intended.

Link: https://lore.kernel.org/20261013-b4-mmap-prepare-vma-flag-sanify-v6-36-1aa3c9b139f9@kernel.org
Signed-off-by: Lorenzo Stoakes (ARM) <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Reviewed-by: Zi Yan <[email protected]>
Acked-by: David Hildenbrand (Arm) <[email protected]>
Cc: Liam R. Howlett <[email protected]>
Cc: Vlastimil Babka <[email protected]>
Cc: Jann Horn <[email protected]>
Cc: Pedro Falcato <[email protected]>
Cc: Mike Rapoport <[email protected]>
Cc: Suren Baghdasaryan <[email protected]>
Cc: Michal Hocko <[email protected]>
Cc: Jonathan Corbet <[email protected]>
Cc: Greg Kroah-Hartman <[email protected]>
Cc: Dennis Dalessandro <[email protected]>
Cc: Jason Gunthorpe <[email protected]>
Cc: Leon Romanovsky <[email protected]>
Cc: Paul Moore <[email protected]>
Cc: Stephen Smalley <[email protected]>
Cc: Jaroslav Kysela <[email protected]>
Cc: Takashi Iwai <[email protected]>
Cc: Alexei Starovoitov <[email protected]>
Cc: Daniel Borkmann <[email protected]>
Cc: Andrii Nakryiko <[email protected]>
Cc: Eduard Zingerman <[email protected]>
Cc: Kumar Kartikeya Dwivedi <[email protected]>
Cc: Baolin Wang <[email protected]>
Cc: Nico Pache <[email protected]>
Cc: Ryan Roberts <[email protected]>
Cc: Dev Jain <[email protected]>
Cc: Barry Song <[email protected]>
Cc: Lance Yang <[email protected]>
Cc: Usama Arif <[email protected]>
Cc: Kiryl Shutsemau <[email protected]>
Cc: Doug Gilbert <[email protected]>
Cc: James Bottomley <[email protected]>
Cc: Martin K. Petersen <[email protected]>
Cc: Simona Vetter <[email protected]>
Cc: Helge Deller <[email protected]>
Cc: Sebastian Reichel <[email protected]>
Cc: John Hubbard <[email protected]>
Cc: Peter Xu <[email protected]>
Cc: Masami Hiramatsu <[email protected]>
Cc: Oleg Nesterov <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Borislav Petkov <[email protected]>
Cc: Dave Hansen <[email protected]>
Cc: Arnaldo Carvalho de Melo <[email protected]>
Cc: Namhyung Kim <[email protected]>
Cc: Mark Rutland <[email protected]>
Cc: Rik van Riel <[email protected]>
Cc: Harry Yoo <[email protected]>
Cc: Juri Lelli <[email protected]>
Cc: Vincent Guittot <[email protected]>
Cc: Maarten Lankhorst <[email protected]>
Cc: Maxime Ripard <[email protected]>
Cc: Thomas Zimmermann <[email protected]>
Cc: David Airlie <[email protected]>
Cc: Will Deacon <[email protected]>
Cc: Aneesh Kumar K.V <[email protected]>
Cc: Nicholas Piggin <[email protected]>
Cc: Arnd Bergmann <[email protected]>
Cc: Muchun Song <[email protected]>
Cc: Oscar Salvador <[email protected]>
Cc: Matthew Wilcox (Oracle) <[email protected]>
Cc: Jan Kara <[email protected]>
Cc: Marc Zyngier <[email protected]>
Cc: Oliver Upton <[email protected]>
Cc: Catalin Marinas <[email protected]>
Cc: Madhavan Srinivasan <[email protected]>
Cc: Anup Patel <[email protected]>
Cc: Paul Walmsley <[email protected]>
Cc: Palmer Dabbelt <[email protected]>
Cc: Albert Ou <[email protected]>
Cc: Christian Borntraeger <[email protected]>
Cc: Janosch Frank <[email protected]>
Cc: Claudio Imbrenda <[email protected]>
Cc: Alexander Gordeev <[email protected]>
Cc: Gerald Schaefer <[email protected]>
Cc: Heiko Carstens <[email protected]>
Cc: Vasily Gorbik <[email protected]>
Cc: David S. Miller <[email protected]>
Cc: Andreas Larsson <[email protected]>
Cc: Al Viro <[email protected]>
Cc: Christian Brauner <[email protected]>
Cc: Matthew Brost <[email protected]>
Cc: Joshua Hahn <[email protected]>
Cc: Rakie Kim <[email protected]>
Cc: Byungchul Park <[email protected]>
Cc: Gregory Price <[email protected]>
Cc: Ying Huang <[email protected]>
Cc: Alistair Popple <[email protected]>
Cc: Chris Li <[email protected]>
Cc: Kairui Song <[email protected]>
Cc: Kemeng Shi <[email protected]>
Cc: Nhat Pham <[email protected]>
Cc: Baoquan He <[email protected]>
Cc: Youngjun Park <[email protected]>
Cc: Johannes Weiner <[email protected]>
Cc: Qi Zheng <[email protected]>
Cc: Shakeel Butt <[email protected]>
Cc: Axel Rasmussen <[email protected]>
Cc: Yuanchu Xie <[email protected]>
Cc: Wei Xu <[email protected]>
Cc: Chengming Zhou <[email protected]>
Cc: Michal Hocko <[email protected]>
Cc: Miklos Szeredi <[email protected]>
Cc: Xu Xin <[email protected]>
Cc: Ihor Solodrai <[email protected]>
Cc: Bert Karwatzki <[email protected]>
This commit is contained in:
Lorenzo Stoakes (ARM)
2026-10-24 01:56:20 -07:00
committed by Andrew Morton
parent 5997da57a0
commit 8bf792b7af
+7 -5
View File
@@ -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;
/* The migrate_vma page walk has no hugetlb support. */
if (!vma_is_mm_backed(vma) || vma_is_hugetlb(vma) || vma_is_dax(vma))
return -EINVAL;
if (nr_pages <= 0)
return -EINVAL;
if (args->start < args->vma->vm_start ||
args->start >= args->vma->vm_end)
if (args->start < vma->vm_start || args->start >= vma->vm_end)
return -EINVAL;
if (args->end <= args->vma->vm_start || args->end > args->vma->vm_end)
if (args->end <= vma->vm_start || args->end > vma->vm_end)
return -EINVAL;
if (!args->src || !args->dst)
return -EINVAL;