Replace use of the legacy vm_flags_t flags with vma_flags_t values in the
migration logic.

We retain the READ_ONCE() of vma->vm_flags in remove_migration_pte(), as
there is no vma_flags_t equivalent, and arch_make_huge_pte() continues to
take legacy flags for the time being.

No functional change intended.

Signed-off-by: Lorenzo Stoakes (ARM) <[email protected]>
---
 mm/migrate.c        | 5 +++--
 mm/migrate_device.c | 8 ++++----
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/mm/migrate.c b/mm/migrate.c
index 28a8d7734735..94033c222e04 100644
--- a/mm/migrate.c
+++ b/mm/migrate.c
@@ -310,7 +310,7 @@ static bool try_to_map_unused_to_zeropage(struct 
page_vma_mapped_walk *pvmw,
        VM_BUG_ON_PAGE(pte_present(old_pte), page);
        VM_WARN_ON_ONCE_FOLIO(folio_is_device_private(folio), folio);
 
-       if (folio_test_mlocked(folio) || (pvmw->vma->vm_flags & VM_LOCKED) ||
+       if (folio_test_mlocked(folio) || vma_test(pvmw->vma, VMA_LOCKED_BIT) ||
            mm_forbids_zeropage(pvmw->vma->vm_mm))
                return false;
 
@@ -2711,7 +2711,8 @@ int migrate_misplaced_folio_prepare(struct folio *folio,
                 * See folio_maybe_mapped_shared() on possible imprecision
                 * when we cannot easily detect if a folio is shared.
                 */
-               if ((vma->vm_flags & VM_EXEC) && 
folio_maybe_mapped_shared(folio))
+               if (vma_test(vma, VMA_EXEC_BIT) &&
+                   folio_maybe_mapped_shared(folio))
                        return -EACCES;
 
                /*
diff --git a/mm/migrate_device.c b/mm/migrate_device.c
index 9e19fadfa65c..c26acbbd2e31 100644
--- a/mm/migrate_device.c
+++ b/mm/migrate_device.c
@@ -842,7 +842,7 @@ static int migrate_vma_insert_huge_pmd_page(struct 
migrate_vma *migrate,
        if (folio_is_device_private(folio)) {
                swp_entry_t swp_entry;
 
-               if (vma->vm_flags & VM_WRITE)
+               if (vma_test(vma, VMA_WRITE_BIT))
                        swp_entry = make_writable_device_private_entry(
                                                page_to_pfn(page));
                else
@@ -855,7 +855,7 @@ static int migrate_vma_insert_huge_pmd_page(struct 
migrate_vma *migrate,
                        goto free_abort;
                }
                entry = folio_mk_pmd(folio, vma->vm_page_prot);
-               if (vma->vm_flags & VM_WRITE)
+               if (vma_test(vma, VMA_WRITE_BIT))
                        entry = pmd_mkwrite(pmd_mkdirty(entry), vma);
        }
 
@@ -1043,7 +1043,7 @@ static void migrate_vma_insert_page(struct migrate_vma 
*migrate,
        if (folio_is_device_private(folio)) {
                swp_entry_t swp_entry;
 
-               if (vma->vm_flags & VM_WRITE)
+               if (vma_test(vma, VMA_WRITE_BIT))
                        swp_entry = make_writable_device_private_entry(
                                                page_to_pfn(page));
                else
@@ -1057,7 +1057,7 @@ static void migrate_vma_insert_page(struct migrate_vma 
*migrate,
                        goto abort;
                }
                entry = mk_pte(page, vma->vm_page_prot);
-               if (vma->vm_flags & VM_WRITE)
+               if (vma_test(vma, VMA_WRITE_BIT))
                        entry = pte_mkwrite(pte_mkdirty(entry), vma);
        }
 

-- 
2.56.0


Reply via email to