From a2fdfd0080a3b15afa81f8495f8b82eb167441a5 Mon Sep 17 00:00:00 2001 From: Lorenzo Stoakes Date: Sat, 11 Jul 2026 19:45:05 +0100 Subject: mm: introduce vma_get_page_prot() and use it There's a large number of vm_get_page_prot(vma->vm_flags) invocations. Make life easier by introducing vma_get_page_prot() parameterised by the VMA. This also makes converting vm_get_page_prot() to vma_flags_t easier. Also update the userland VMA tests to reflect the change. No functional change intended. Link: https://lore.kernel.org/20260711-b4-vma-flags-mm-v2-8-0fa2357d5431@kernel.org Signed-off-by: Lorenzo Stoakes Acked-by: Zi Yan Acked-by: Jani Nikula # for i915 Reviewed-by: Thomas Zimmermann [DRM] Reviewed-by: Vlastimil Babka (SUSE) Cc: Baolin Wang Cc: Barry Song Cc: Christian Brauner Cc: Dave Airlie Cc: David Hildenbrand Cc: Dev Jain Cc: Jan Kara Cc: Jann Horn Cc: Lance Yang Cc: Mike Rapoport Cc: Muchun Song Cc: Nico Pache Cc: Oscar Salvador Cc: Pedro Falcato Cc: Suren Baghdasaryan Signed-off-by: Andrew Morton --- tools/testing/vma/include/dup.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'tools/testing/vma/include') diff --git a/tools/testing/vma/include/dup.h b/tools/testing/vma/include/dup.h index 73a637d9472e..ba02017eca2e 100644 --- a/tools/testing/vma/include/dup.h +++ b/tools/testing/vma/include/dup.h @@ -1575,3 +1575,8 @@ static inline void vma_assert_can_modify(struct vm_area_struct *vma) if (vma_is_attached(vma)) vma_assert_write_locked(vma); } + +static inline pgprot_t vma_get_page_prot(const struct vm_area_struct *vma) +{ + return vma_flags_to_page_prot(vma->flags); +} -- cgit