[PATCH 41/45] mm/migrate_device: Make migrate_vma_test_walk skip hugetlb vmas

From: Oscar Salvador
Date: Thu Jul 04 2024 - 00:40:59 EST


Skip hugetlb vmas as we are not interested in those.

Signed-off-by: Oscar Salvador <osalvador@xxxxxxx>
---
mm/migrate_device.c | 12 ++++++++++++
1 file changed, 12 insertions(+)

diff --git a/mm/migrate_device.c b/mm/migrate_device.c
index 6d66dc1c6ffa..c44ac45b207d 100644
--- a/mm/migrate_device.c
+++ b/mm/migrate_device.c
@@ -279,8 +279,20 @@ static int migrate_vma_collect_pmd(pmd_t *pmdp,
return 0;
}

+static int migrate_vma_test_walk(unsigned long start, unsigned long end,
+ struct mm_walk *walk)
+{
+ struct vm_area_struct *vma = walk->vma;
+
+ if (is_vm_hugetlb_page(vma))
+ return 1;
+
+ return 0;
+}
+
static const struct mm_walk_ops migrate_vma_walk_ops = {
.pmd_entry = migrate_vma_collect_pmd,
+ .test_walk = migrate_vma_test_walk,
.pte_hole = migrate_vma_collect_hole,
.walk_lock = PGWALK_RDLOCK,
};
--
2.26.2