mm-update-core-kernel-code-to-use-vm_flags_t-consistently.patch removed from -mm tree
The quilt patch titled
Subject: mm: update core kernel code to use vm_flags_t consistently
has been removed from the -mm tree. Its filename was
mm-update-core-kernel-code-to-use-vm_flags_t-consistently.patch
This patch was dropped because it was merged into the mm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
------------------------------------------------------
From: Lorenzo Stoakes <[email protected]>
Subject: mm: update core kernel code to use vm_flags_t consistently
Date: Wed, 18 Jun 2025 20:42:53 +0100
The core kernel code is currently very inconsistent in its use of vm_flags_t vs. unsigned long. This prevents us from changing the type of vm_flags_t in the future and is simply not correct, so correct this.
While this results in rather a lot of churn, it is a critical pre-requisite for a future planned change to VMA flag type.
Additionally, update VMA userland tests to account for the changes.
To make review easier and to break things into smaller parts, driver and architecture-specific changes is left for a subsequent commit.
The code has been adjusted to cascade the changes across all calling code as far as is needed.
We will adjust architecture-specific and driver code in a subsequent patch.
Overall, this patch does not introduce any functional change.
---
fs/exec.c | 2 fs/userfaultfd.c | 2 include/linux/coredump.h | 2 include/linux/huge_mm.h | 12 - include/linux/khugepaged.h | 4 include/linux/ksm.h | 4 include/linux/memfd.h | 4 include/linux/mm.h | 6 include/linux/mm_types.h | 2 include/linux/mman.h | 4 include/linux/rmap.h | 4 include/linux/userfaultfd_k.h | 4 include/trace/events/fs_dax.h | 6 mm/debug.c | 2 mm/execmem.c | 8 mm/filemap.c | 2 mm/gup.c | 2 mm/huge_memory.c | 2 mm/hugetlb.c | 4 mm/internal.h | 4 mm/khugepaged.c | 4 mm/ksm.c | 2 mm/madvise.c | 4 mm/mapping_dirty_helpers.c | 2 mm/memfd.c | 8 mm/memory.c | 4 mm/mmap.c | 16 - mm/mprotect.c | 8 mm/mremap.c | 2 mm/nommu.c | 12 - mm/rmap.c | 4 mm/shmem.c | 6 mm/userfaultfd.c | 14 - mm/vma.c | 80 ++++---- mm/vma.h | 16 - mm/vmscan.c | 4 tools/testing/vma/vma.c | 266 ++++++++++++++--------------- tools/testing/vma/vma_internal.h | 8 38 files changed, 270 insertions(+), 270 deletions(-)
fs/exec.c renamed from fs/exec.c~mm-update-core-kernel-code-to-use-vm_flags_t-consistently +1 -1
@@ -604,7 +604,7 @@ int setup_arg_pages(struct linux_binprmstruct mm_struct *mm = current->mm;struct vm_area_struct *vma = bprm->vma;struct vm_area_struct *prev =NULL ; -unsigned long vm_flags; +vm_flags_t vm_flags;unsigned long stack_base;unsigned long stack_size;unsigned long stack_expand;
fs/userfaultfd.c renamed from fs/userfaultfd.c~mm-update-core-kernel-code-to-use-vm_flags_t-consistently +1 -1
@@ -1242,7 +1242,7 @@ static int userfaultfd_register(struct uint ret;struct uffdio_register uffdio_register;struct uffdio_register __user *user_uffdio_register; -unsigned long vm_flags; +vm_flags_t vm_flags;bool found;bool basic_ioctls;unsigned long start, end;
include/linux/coredump.h renamed from include/linux/coredump.h~mm-update-core-kernel-code-to-use-vm_flags_t-consistently +1 -1
@@ -10,7 +10,7 @@ #ifdef CONFIG_COREDUMP struct core_vma_metadata { unsigned long start, end; - unsigned long flags; + vm_flags_t flags; unsigned long dump_size; unsigned long pgoff; struct file *file;
include/linux/huge_mm.h renamed from include/linux/huge_mm.h~mm-update-core-kernel-code-to-use-vm_flags_t-consistently +6 -6
@@ -261,7 +261,7 @@ static inline unsigned long thp_vma_suit }unsigned long __thp_vma_allowable_orders (struct vm_area_struct *vma, -unsigned long vm_flags, +vm_flags_t vm_flags,unsigned long tva_flags,unsigned long orders);
@@ -282,7 +282,7 @@ unsigned long __thp_vma_allowable_orders*/ static inline unsigned long thp_vma_allowable_orders (struct vm_area_struct *vma, -unsigned long vm_flags, +vm_flags_t vm_flags,unsigned long tva_flags,unsigned long orders) {
@@ -317,7 +317,7 @@ struct thpsize { (1<<TRANSPARENT_HUGEPAGE_USE_ZERO_PAGE_FLAG))static inline bool vma_thp_disabled (struct vm_area_struct *vma, -unsigned long vm_flags) +vm_flags_t vm_flags) {/* * Explicitly disabled through madvise or prctl, or some
@@ -431,7 +431,7 @@ change_huge_pud(struct mmu_gather *tlb,__split_huge_pud (__vma, __pud, __address); \ }while (0 ) -int hugepage_madvise(struct vm_area_struct *vma, unsigned long *vm_flags, +int hugepage_madvise(struct vm_area_struct *vma, vm_flags_t *vm_flags, int advice); int madvise_collapse(struct vm_area_struct *vma, struct vm_area_struct **prev,
@@ -524,7 +524,7 @@ static inline unsigned long thp_vma_suit }static inline unsigned long thp_vma_allowable_orders (struct vm_area_struct *vma, -unsigned long vm_flags, +vm_flags_t vm_flags,unsigned long tva_flags,unsigned long orders) {
@@ -593,7 +593,7 @@ static inline bool unmap_huge_pmd_locked do { } while (0)static inline int hugepage_madvise (struct vm_area_struct *vma, -unsigned long *vm_flags,int advice) +vm_flags_t *vm_flags,int advice) {return -EINVAL ; }
include/linux/khugepaged.h renamed from include/linux/khugepaged.h~mm-update-core-kernel-code-to-use-vm_flags_t-consistently +2 -2
@@ -12,7 +12,7 @@ extern int start_stop_khugepaged(void);extern void __khugepaged_enter (struct mm_struct *mm);extern void __khugepaged_exit (struct mm_struct *mm);extern void khugepaged_enter_vma (struct vm_area_struct *vma, -unsigned long vm_flags); +vm_flags_t vm_flags);extern void khugepaged_min_free_kbytes_update (void );extern bool current_is_khugepaged (void ); extern int collapse_pte_mapped_thp(struct mm_struct *mm, unsigned long addr,
@@ -37,7 +37,7 @@ static inline void khugepaged_exit(struc { }static inline void khugepaged_enter_vma (struct vm_area_struct *vma, -unsigned long vm_flags) +vm_flags_t vm_flags) { } static inline int collapse_pte_mapped_thp(struct mm_struct *mm,
include/linux/ksm.h renamed from include/linux/ksm.h~mm-update-core-kernel-code-to-use-vm_flags_t-consistently +2 -2
@@ -16,7 +16,7 @@#ifdef CONFIG_KSM int ksm_madvise (struct vm_area_struct *vma,unsigned long start, -unsigned long end,int advice,unsigned long *vm_flags); +unsigned long end,int advice,vm_flags_t *vm_flags);vm_flags_t ksm_vma_flags (const struct mm_struct *mm,const struct file *file,vm_flags_t vm_flags);int ksm_enable_merge_any (struct mm_struct *mm);
@@ -133,7 +133,7 @@ static inline void collect_procs_ksm(con#ifdef CONFIG_MMU static inline int ksm_madvise (struct vm_area_struct *vma,unsigned long start, -unsigned long end,int advice,unsigned long *vm_flags) +unsigned long end,int advice,vm_flags_t *vm_flags) {return 0 ; }
include/linux/memfd.h renamed from include/linux/memfd.h~mm-update-core-kernel-code-to-use-vm_flags_t-consistently +2 -2
@@ -14,7 +14,7 @@ struct folio *memfd_alloc_folio(struct f* We also update VMA flags if appropriate by manipulating the VMA flags pointed * to by vm_flags_ptr. */ -int memfd_check_seals_mmap (struct file *file,unsigned long *vm_flags_ptr); +int memfd_check_seals_mmap (struct file *file,vm_flags_t *vm_flags_ptr);#else static inline long memfd_fcntl (struct file *f,unsigned int c,unsigned int a) {
@@ -25,7 +25,7 @@ static inline struct folio *memfd_alloc_return ERR_PTR (-EINVAL ); }static inline int memfd_check_seals_mmap (struct file *file, -unsigned long *vm_flags_ptr) +vm_flags_t *vm_flags_ptr) {return 0 ; }
include/linux/mman.h renamed from include/linux/mman.h~mm-update-core-kernel-code-to-use-vm_flags_t-consistently +2 -2
@@ -137,7 +137,7 @@ static inline bool arch_validate_flags(u/* * Combine the mmap "prot" argument into "vm_flags" used internally. */ -static inline unsigned long +static inline vm_flags_t calc_vm_prot_bits (unsigned long prot,unsigned long pkey) { return _calc_vm_trans(prot, PROT_READ, VM_READ ) |
@@ -149,7 +149,7 @@ calc_vm_prot_bits(unsigned long prot, un/* * Combine the mmap "flags" argument into "vm_flags" used internally. */ -static inline unsigned long +static inline vm_flags_t calc_vm_flag_bits (struct file *file,unsigned long flags) { return _calc_vm_trans(flags, MAP_GROWSDOWN, VM_GROWSDOWN ) |
include/linux/mm.h renamed from include/linux/mm.h~mm-update-core-kernel-code-to-use-vm_flags_t-consistently +3 -3
@@ -2564,7 +2564,7 @@ extern long change_protection(struct mmu unsigned long end, unsigned long cp_flags);extern int mprotect_fixup (struct vma_iterator *vmi,struct mmu_gather *tlb,struct vm_area_struct *vma,struct vm_area_struct **pprev, -unsigned long start,unsigned long end,unsigned long newflags); +unsigned long start,unsigned long end,vm_flags_t newflags);/* * doesn't attempt to fault and will return short.
@@ -3323,9 +3323,9 @@ extern void vm_stat_account(struct mm_stextern bool vma_is_special_mapping (const struct vm_area_struct *vma,const struct vm_special_mapping *sm); -extern struct vm_area_struct *_install_special_mapping (struct mm_struct *mm, +struct vm_area_struct *_install_special_mapping (struct mm_struct *mm,unsigned long addr,unsigned long len, -unsigned long flags, +vm_flags_t vm_flags,const struct vm_special_mapping *spec);unsigned long randomize_stack_top (unsigned long stack_top);
include/linux/mm_types.h renamed from include/linux/mm_types.h~mm-update-core-kernel-code-to-use-vm_flags_t-consistently +1 -1
@@ -1081,7 +1081,7 @@ struct mm_struct {unsigned long data_vm;/* VM_WRITE & ~VM_SHARED & ~VM_STACK */ unsigned long exec_vm;/* VM_EXEC & ~VM_WRITE & ~VM_STACK */ unsigned long stack_vm;/* VM_STACK */ -unsigned long def_flags; +vm_flags_t def_flags;/** * @write_protect_seq: Locked when any thread is write
include/linux/rmap.h renamed from include/linux/rmap.h~mm-update-core-kernel-code-to-use-vm_flags_t-consistently +2 -2
@@ -893,7 +893,7 @@ static inline int folio_try_share_anon_r* Called from mm/vmscan.c to handle paging out */ int folio_referenced (struct folio *,int is_locked, -struct mem_cgroup *memcg,unsigned long *vm_flags); +struct mem_cgroup *memcg,vm_flags_t *vm_flags);void try_to_migrate (struct folio *folio,enum ttu_flags flags);void try_to_unmap (struct folio *,enum ttu_flags flags);
@@ -1025,7 +1025,7 @@ struct anon_vma *folio_lock_anon_vma_reastatic inline int folio_referenced (struct folio *folio,int is_locked,struct mem_cgroup *memcg, -unsigned long *vm_flags) +vm_flags_t *vm_flags) { *vm_flags =0 ;return 0 ;
include/linux/userfaultfd_k.h renamed from include/linux/userfaultfd_k.h~mm-update-core-kernel-code-to-use-vm_flags_t-consistently +2 -2
@@ -209,7 +209,7 @@ static inline bool userfaultfd_armed(str }static inline bool vma_can_userfault (struct vm_area_struct *vma, -unsigned long vm_flags, +vm_flags_t vm_flags,bool wp_async) { vm_flags &= __VM_UFFD_FLAGS;
@@ -281,7 +281,7 @@ struct vm_area_struct *userfaultfd_clearint userfaultfd_register_range (struct userfaultfd_ctx *ctx,struct vm_area_struct *vma, -unsigned long vm_flags, +vm_flags_t vm_flags,unsigned long start,unsigned long end,bool wp_async);
include/trace/events/fs_dax.h renamed from include/trace/events/fs_dax.h~mm-update-core-kernel-code-to-use-vm_flags_t-consistently +3 -3
@@ -15,7 +15,7 @@ DECLARE_EVENT_CLASS(dax_pmd_fault_class, __field(unsigned long, ino) __field(unsigned long, vm_start) __field(unsigned long, vm_end) - __field(unsigned long, vm_flags) + __field(vm_flags_t, vm_flags) __field(unsigned long, address) __field(pgoff_t, pgoff) __field(pgoff_t, max_pgoff)
@@ -67,7 +67,7 @@ DECLARE_EVENT_CLASS(dax_pmd_load_hole_cl TP_ARGS(inode, vmf, zero_folio, radix_entry),TP_STRUCT__entry (__field (unsigned long ,ino ) - __field(unsigned long, vm_flags) +__field (vm_flags_t, vm_flags) __field(unsigned long, address) __field(struct folio *, zero_folio) __field(void *, radix_entry)
@@ -107,7 +107,7 @@ DECLARE_EVENT_CLASS(dax_pte_fault_class, TP_ARGS(inode, vmf, result),TP_STRUCT__entry (__field (unsigned long ,ino ) - __field(unsigned long, vm_flags) +__field (vm_flags_t, vm_flags) __field(unsigned long, address)__field (pgoff_t, pgoff) __field(dev_t, dev)
mm/debug.c renamed from mm/debug.c~mm-update-core-kernel-code-to-use-vm_flags_t-consistently +1 -1
@@ -290,7 +290,7 @@ void dump_vmg(const struct vma_merge_str vmg->vmi, vmg->vmi ?vma_iter_addr (vmg->vmi) :0 , vmg->vmi ?vma_iter_end (vmg->vmi) :0 , vmg->prev, vmg->middle, vmg->next, vmg->target, - vmg->start, vmg->end, vmg->flags, + vmg->start, vmg->end, vmg->vm_flags, vmg->file, vmg->anon_vma, vmg->policy, #ifdef CONFIG_USERFAULTFD vmg->uffd_ctx.ctx,
mm/execmem.c renamed from mm/execmem.c~mm-update-core-kernel-code-to-use-vm_flags_t-consistently +4 -4
@@ -26,7 +26,7 @@ static struct execmem_info default_execm#ifdef CONFIG_MMU static void *execmem_vmalloc (struct execmem_range *range,size_t size, -pgprot_t pgprot,unsigned long vm_flags) +pgprot_t pgprot,vm_flags_t vm_flags) {bool kasan = range->flags &EXECMEM_KASAN_SHADOW ;gfp_t gfp_flags =GFP_KERNEL | __GFP_NOWARN;
@@ -82,7 +82,7 @@ struct vm_struct *execmem_vmap(size_t si }#else static void *execmem_vmalloc (struct execmem_range *range,size_t size, -pgprot_t pgprot,unsigned long vm_flags) +pgprot_t pgprot,vm_flags_t vm_flags) {return vmalloc (size); }
@@ -256,7 +256,7 @@ out_unlock:static int execmem_cache_populate (struct execmem_range *range,size_t size) { -unsigned long vm_flags =VM_ALLOW_HUGE_VMAP ; +vm_flags_t vm_flags =VM_ALLOW_HUGE_VMAP ;struct vm_struct *vm;size_t alloc_size;int err = -ENOMEM ;
@@ -373,7 +373,7 @@ void *execmem_alloc(enum execmem_type ty {struct execmem_range *range = &execmem_info->ranges[type];bool use_cache = range->flags &EXECMEM_ROX_CACHE ; -unsigned long vm_flags =VM_FLUSH_RESET_PERMS ; +vm_flags_t vm_flags =VM_FLUSH_RESET_PERMS ;pgprot_t pgprot = range->pgprot;void *p;
mm/filemap.c renamed from mm/filemap.c~mm-update-core-kernel-code-to-use-vm_flags_t-consistently +1 -1
@@ -3216,7 +3216,7 @@ static struct file *do_sync_mmap_readahestruct address_space *mapping = file->f_mapping;DEFINE_READAHEAD (ractl, file, ra, mapping, vmf->pgoff);struct file *fpin =NULL ; -unsigned long vm_flags = vmf->vma->vm_flags; +vm_flags_t vm_flags = vmf->vma->vm_flags;unsigned short mmap_miss;#ifdef CONFIG_TRANSPARENT_HUGEPAGE
mm/gup.c renamed from mm/gup.c~mm-update-core-kernel-code-to-use-vm_flags_t-consistently +1 -1
@@ -2044,7 +2044,7 @@ static long __get_user_pages_locked(stru {struct vm_area_struct *vma;bool must_unlock = false; -unsigned long vm_flags; +vm_flags_t vm_flags;long i;if (!nr_pages)
mm/huge_memory.c renamed from mm/huge_memory.c~mm-update-core-kernel-code-to-use-vm_flags_t-consistently +1 -1
@@ -99,7 +99,7 @@ static inline bool file_thp_enabled(stru }unsigned long __thp_vma_allowable_orders (struct vm_area_struct *vma, -unsigned long vm_flags, +vm_flags_t vm_flags,unsigned long tva_flags,unsigned long orders) {
mm/hugetlb.c renamed from mm/hugetlb.c~mm-update-core-kernel-code-to-use-vm_flags_t-consistently +2 -2
@@ -7465,8 +7465,8 @@ static unsigned long page_table_shareablunsigned long s_end = sbase +PUD_SIZE ;/* Allow segments to share if only one is marked locked */ -unsigned long vm_flags = vma->vm_flags & ~VM_LOCKED_MASK ; -unsigned long svm_flags = svma->vm_flags & ~VM_LOCKED_MASK ; +vm_flags_t vm_flags = vma->vm_flags & ~VM_LOCKED_MASK ; +vm_flags_t svm_flags = svma->vm_flags & ~VM_LOCKED_MASK ;/* * match the virtual addresses, permission and the alignment of the
mm/internal.h renamed from mm/internal.h~mm-update-core-kernel-code-to-use-vm_flags_t-consistently +2 -2
@@ -928,7 +928,7 @@ extern long populate_vma_page_range(stru unsigned long start, unsigned long end, int *locked);extern long faultin_page_range (struct mm_struct *mm,unsigned long start,unsigned long end,bool write,int *locked); -extern bool mlock_future_ok (struct mm_struct *mm,unsigned long flags, +extern bool mlock_future_ok (struct mm_struct *mm,vm_flags_t vm_flags,unsigned long bytes);/*
@@ -1358,7 +1358,7 @@ int migrate_device_coherent_folio(structstruct vm_struct *__get_vm_area_node (unsigned long size,unsigned long align,unsigned long shift, -unsigned long flags,unsigned long start, +vm_flags_t vm_flags,unsigned long start,unsigned long end,int node,gfp_t gfp_mask,const void *caller);
mm/khugepaged.c renamed from mm/khugepaged.c~mm-update-core-kernel-code-to-use-vm_flags_t-consistently +2 -2
@@ -347,7 +347,7 @@ struct attribute_group khugepaged_attr_g#endif /* CONFIG_SYSFS */ int hugepage_madvise (struct vm_area_struct *vma, -unsigned long *vm_flags,int advice) +vm_flags_t *vm_flags,int advice) {switch (advice) {case MADV_HUGEPAGE :
@@ -470,7 +470,7 @@ void __khugepaged_enter(struct mm_struct }void khugepaged_enter_vma (struct vm_area_struct *vma, -unsigned long vm_flags) +vm_flags_t vm_flags) {if (!test_bit (MMF_VM_HUGEPAGE , &vma->vm_mm->flags) &&hugepage_pmd_enabled ()) {
mm/ksm.c renamed from mm/ksm.c~mm-update-core-kernel-code-to-use-vm_flags_t-consistently +1 -1
@@ -2840,7 +2840,7 @@ int ksm_disable(struct mm_struct *mm) }int ksm_madvise (struct vm_area_struct *vma,unsigned long start, -unsigned long end,int advice,unsigned long *vm_flags) +unsigned long end,int advice,vm_flags_t *vm_flags) {struct mm_struct *mm = vma->vm_mm;int err;
mm/madvise.c renamed from mm/madvise.c~mm-update-core-kernel-code-to-use-vm_flags_t-consistently +2 -2
@@ -130,7 +130,7 @@ static int replace_anon_vma_name(struct*/ static int madvise_update_vma (struct vm_area_struct *vma,struct vm_area_struct **prev,unsigned long start, -unsigned long end,unsigned long new_flags, +unsigned long end,vm_flags_t new_flags,struct anon_vma_name *anon_name) {struct mm_struct *mm = vma->vm_mm;
@@ -1258,7 +1258,7 @@ static int madvise_vma_behavior(struct vint behavior = arg->behavior;int error;struct anon_vma_name *anon_name; -unsigned long new_flags = vma->vm_flags; +vm_flags_t new_flags = vma->vm_flags;if (unlikely (!can_modify_vma_madv (vma, behavior)))return -EPERM ;
mm/mapping_dirty_helpers.c renamed from mm/mapping_dirty_helpers.c~mm-update-core-kernel-code-to-use-vm_flags_t-consistently +1 -1
@@ -218,7 +218,7 @@ static void wp_clean_post_vma(struct mm_static int wp_clean_test_walk (unsigned long start,unsigned long end,struct mm_walk *walk) { -unsigned long vm_flags =READ_ONCE (walk->vma->vm_flags); +vm_flags_t vm_flags =READ_ONCE (walk->vma->vm_flags);/* Skip non-applicable VMAs */ if ((vm_flags & (VM_SHARED | VM_MAYWRITE | VM_HUGETLB)) !=
mm/memfd.c renamed from mm/memfd.c~mm-update-core-kernel-code-to-use-vm_flags_t-consistently +4 -4
@@ -332,10 +332,10 @@ static inline bool is_write_sealed(unsigreturn seals & (F_SEAL_WRITE |F_SEAL_FUTURE_WRITE ); } -static int check_write_seal (unsigned long *vm_flags_ptr) +static int check_write_seal (vm_flags_t *vm_flags_ptr) { -unsigned long vm_flags = *vm_flags_ptr; -unsigned long mask = vm_flags & (VM_SHARED |VM_WRITE ); +vm_flags_t vm_flags = *vm_flags_ptr; +vm_flags_t mask = vm_flags & (VM_SHARED |VM_WRITE );/* If a private mapping then writability is irrelevant. */ if (!(mask &VM_SHARED ))
@@ -357,7 +357,7 @@ static int check_write_seal(unsigned lonreturn 0 ; } -int memfd_check_seals_mmap (struct file *file,unsigned long *vm_flags_ptr) +int memfd_check_seals_mmap (struct file *file,vm_flags_t *vm_flags_ptr) {int err =0 ;unsigned int *seals_ptr =memfd_file_seals_ptr (file);
mm/memory.c renamed from mm/memory.c~mm-update-core-kernel-code-to-use-vm_flags_t-consistently +2 -2
@@ -797,7 +797,7 @@ copy_nonpresent_pte(struct mm_struct *ds pte_t *dst_pte, pte_t *src_pte, struct vm_area_struct *dst_vma, struct vm_area_struct *src_vma, unsigned long addr, int *rss) { -unsigned long vm_flags = dst_vma->vm_flags; +vm_flags_t vm_flags = dst_vma->vm_flags;pte_t orig_pte =ptep_get (src_pte);pte_t pte = orig_pte;struct folio *folio;
@@ -6128,7 +6128,7 @@ static vm_fault_t __handle_mm_fault(stru .gfp_mask = __get_fault_gfp_mask(vma), };struct mm_struct *mm = vma->vm_mm; -unsigned long vm_flags = vma->vm_flags; +vm_flags_t vm_flags = vma->vm_flags;pgd_t *pgd;p4d_t *p4d;vm_fault_t ret;
mm/mmap.c renamed from mm/mmap.c~mm-update-core-kernel-code-to-use-vm_flags_t-consistently +8 -8
@@ -80,7 +80,7 @@ core_param(ignore_rlimit_data, ignore_rl/* Update vma->vm_page_prot to reflect vma->vm_flags. */ void vma_set_page_prot (struct vm_area_struct *vma) { -unsigned long vm_flags = vma->vm_flags; +vm_flags_t vm_flags = vma->vm_flags;pgprot_t vm_page_prot; vm_page_prot =vm_pgprot_modify (vma->vm_page_prot, vm_flags);
@@ -228,12 +228,12 @@ static inline unsigned long round_hint_treturn hint; } -bool mlock_future_ok (struct mm_struct *mm,unsigned long flags, +bool mlock_future_ok (struct mm_struct *mm,vm_flags_t vm_flags,unsigned long bytes) {unsigned long locked_pages, limit_pages; -if (!(flags &VM_LOCKED ) ||capable (CAP_IPC_LOCK )) +if (!(vm_flags &VM_LOCKED ) ||capable (CAP_IPC_LOCK ))return true; locked_pages = bytes >>PAGE_SHIFT ;
@@ -1207,7 +1207,7 @@ out:return ret; } -int vm_brk_flags (unsigned long addr,unsigned long request,unsigned long flags) +int vm_brk_flags (unsigned long addr,unsigned long request,vm_flags_t vm_flags) {struct mm_struct *mm = current->mm;struct vm_area_struct *vma =NULL ;
@@ -1224,7 +1224,7 @@ int vm_brk_flags(unsigned long addr, unsreturn 0 ;/* Until we need other flags, refuse anything except VM_EXEC. */ -if ((flags & (~VM_EXEC )) !=0 ) +if ((vm_flags & (~VM_EXEC )) !=0 )return -EINVAL ;if (mmap_write_lock_killable (mm))
@@ -1239,7 +1239,7 @@ int vm_brk_flags(unsigned long addr, uns goto munmap_failed; vma =vma_prev (&vmi); - ret =do_brk_flags (&vmi, vma, addr, len, flags); + ret =do_brk_flags (&vmi, vma, addr, len, vm_flags); populate = ((mm->def_flags &VM_LOCKED ) !=0 );mmap_write_unlock (mm);userfaultfd_unmap_complete (mm, &uf);
@@ -1444,7 +1444,7 @@ static vm_fault_t special_mapping_fault(static struct vm_area_struct *__install_special_mapping (struct mm_struct *mm,unsigned long addr,unsigned long len, -unsigned long vm_flags,void *priv, +vm_flags_t vm_flags,void *priv,const struct vm_operations_struct *ops) {int ret;
@@ -1496,7 +1496,7 @@ bool vma_is_special_mapping(const structstruct vm_area_struct *_install_special_mapping (struct mm_struct *mm,unsigned long addr,unsigned long len, -unsigned long vm_flags,const struct vm_special_mapping *spec) +vm_flags_t vm_flags,const struct vm_special_mapping *spec) {return __install_special_mapping (mm, addr, len, vm_flags, (void *)spec, &special_mapping_vmops);
mm/mprotect.c renamed from mm/mprotect.c~mm-update-core-kernel-code-to-use-vm_flags_t-consistently +4 -4
@@ -596,10 +596,10 @@ static const struct mm_walk_ops prot_nonint mprotect_fixup (struct vma_iterator *vmi,struct mmu_gather *tlb,struct vm_area_struct *vma,struct vm_area_struct **pprev, -unsigned long start,unsigned long end,unsigned long newflags) +unsigned long start,unsigned long end,vm_flags_t newflags) {struct mm_struct *mm = vma->vm_mm; -unsigned long oldflags =READ_ONCE (vma->vm_flags); +vm_flags_t oldflags =READ_ONCE (vma->vm_flags);long nrpages = (end - start) >>PAGE_SHIFT ;unsigned int mm_cp_flags =0 ;unsigned long charged =0 ;
@@ -774,8 +774,8 @@ static int do_mprotect_pkey(unsigned lon nstart = start; tmp = vma->vm_start;for_each_vma_range (vmi, vma, end) { -unsigned long mask_off_old_flags; -unsigned long newflags; +vm_flags_t mask_off_old_flags; +vm_flags_t newflags;int new_vma_pkey;if (vma->vm_start != tmp) {
mm/mremap.c renamed from mm/mremap.c~mm-update-core-kernel-code-to-use-vm_flags_t-consistently +1 -1
@@ -1025,7 +1025,7 @@ static unsigned long prep_move_vma(strucstruct vm_area_struct *vma = vrm->vma;unsigned long old_addr = vrm->addr;unsigned long old_len = vrm->old_len; -unsigned long dummy = vma->vm_flags; +vm_flags_t dummy = vma->vm_flags;/* * We'd prefer to avoid failure later on in do_munmap:
mm/nommu.c renamed from mm/nommu.c~mm-update-core-kernel-code-to-use-vm_flags_t-consistently +6 -6
@@ -126,7 +126,7 @@ void *vrealloc_noprof(const void *p, sizvoid *__vmalloc_node_range_noprof (unsigned long size,unsigned long align,unsigned long start,unsigned long end,gfp_t gfp_mask, -pgprot_t prot,unsigned long vm_flags,int node, +pgprot_t prot,vm_flags_t vm_flags,int node,const void *caller) {return __vmalloc_noprof (size, gfp_mask);
@@ -844,12 +844,12 @@ static int validate_mmap_request(struct* we've determined that we can make the mapping, now translate what we * now know into VMA flags */ -static unsigned long determine_vm_flags (struct file *file, -unsigned long prot, -unsigned long flags, -unsigned long capabilities) +static vm_flags_t determine_vm_flags (struct file *file, +unsigned long prot, +unsigned long flags, +unsigned long capabilities) { -unsigned long vm_flags; +vm_flags_t vm_flags; vm_flags =calc_vm_prot_bits (prot,0 ) |calc_vm_flag_bits (file, flags);
mm/rmap.c renamed from mm/rmap.c~mm-update-core-kernel-code-to-use-vm_flags_t-consistently +2 -2
@@ -839,7 +839,7 @@ out:struct folio_referenced_arg {int mapcount;int referenced; -unsigned long vm_flags; +vm_flags_t vm_flags;struct mem_cgroup *memcg; };
@@ -984,7 +984,7 @@ static bool invalid_folio_referenced_vma* the function bailed out due to rmap lock contention. */ int folio_referenced (struct folio *folio,int is_locked, -struct mem_cgroup *memcg,unsigned long *vm_flags) +struct mem_cgroup *memcg,vm_flags_t *vm_flags) {bool we_locked = false;struct folio_referenced_arg pra = {
mm/shmem.c renamed from mm/shmem.c~mm-update-core-kernel-code-to-use-vm_flags_t-consistently +3 -3
@@ -615,7 +615,7 @@ static unsigned int shmem_get_orders_witstatic unsigned int shmem_huge_global_enabled (struct inode *inode,pgoff_t index,loff_t write_end,bool shmem_huge_force,struct vm_area_struct *vma, -unsigned long vm_flags) +vm_flags_t vm_flags) {unsigned int maybe_pmd_order =HPAGE_PMD_ORDER >MAX_PAGECACHE_ORDER ?0 :BIT (HPAGE_PMD_ORDER );
@@ -862,7 +862,7 @@ static unsigned long shmem_unused_huge_sstatic unsigned int shmem_huge_global_enabled (struct inode *inode,pgoff_t index,loff_t write_end,bool shmem_huge_force,struct vm_area_struct *vma, -unsigned long vm_flags) +vm_flags_t vm_flags) {return 0 ; }
@@ -1753,7 +1753,7 @@ unsigned long shmem_allowable_huge_order {unsigned long mask =READ_ONCE (huge_shmem_orders_always);unsigned long within_size_orders =READ_ONCE (huge_shmem_orders_within_size); -unsigned long vm_flags = vma ? vma->vm_flags :0 ; +vm_flags_t vm_flags = vma ? vma->vm_flags :0 ;unsigned int global_orders;if (thp_disabled_by_hw () || (vma &&vma_thp_disabled (vma, vm_flags)))
mm/userfaultfd.c renamed from mm/userfaultfd.c~mm-update-core-kernel-code-to-use-vm_flags_t-consistently +7 -7
@@ -1901,11 +1901,11 @@ out: }static void userfaultfd_set_vm_flags (struct vm_area_struct *vma, -vm_flags_t flags) +vm_flags_t vm_flags) { -const bool uffd_wp_changed = (vma->vm_flags ^ flags) &VM_UFFD_WP ; +const bool uffd_wp_changed = (vma->vm_flags ^ vm_flags) &VM_UFFD_WP ; -vm_flags_reset (vma, flags); +vm_flags_reset (vma, vm_flags);/* * For shared mappings, we want to enable writenotify while * userfaultfd-wp is enabled (see vma_wants_writenotify()). We'll simply
@@ -1917,12 +1917,12 @@ static void userfaultfd_set_vm_flags(strstatic void userfaultfd_set_ctx (struct vm_area_struct *vma,struct userfaultfd_ctx *ctx, -unsigned long flags) +vm_flags_t vm_flags) {vma_start_write (vma); vma->vm_userfaultfd_ctx = (struct vm_userfaultfd_ctx ){ctx};userfaultfd_set_vm_flags (vma, - (vma->vm_flags & ~__VM_UFFD_FLAGS) | flags); + (vma->vm_flags & ~__VM_UFFD_FLAGS) | vm_flags); }void userfaultfd_reset_ctx (struct vm_area_struct *vma)
@@ -1968,14 +1968,14 @@ struct vm_area_struct *userfaultfd_clear/* Assumes mmap write lock taken, and mm_struct pinned. */ int userfaultfd_register_range (struct userfaultfd_ctx *ctx,struct vm_area_struct *vma, -unsigned long vm_flags, +vm_flags_t vm_flags,unsigned long start,unsigned long end,bool wp_async) {VMA_ITERATOR (vmi, ctx->mm, start);struct vm_area_struct *prev =vma_prev (&vmi);unsigned long vma_end; -unsigned long new_flags; +vm_flags_t new_flags;if (vma->vm_start < start) prev = vma;
mm/vma.c renamed from mm/vma.c~mm-update-core-kernel-code-to-use-vm_flags_t-consistently +40 -40
277 lines not on this page · raw message
mm/vma.h renamed from mm/vma.h~mm-update-core-kernel-code-to-use-vm_flags_t-consistently +8 -8
@@ -98,7 +98,7 @@ struct vma_merge_struct {unsigned long end;pgoff_t pgoff; -unsigned long flags; +vm_flags_t vm_flags;struct file *file;struct anon_vma *anon_vma;struct mempolicy *policy;
@@ -164,13 +164,13 @@ static inline pgoff_t vma_pgoff_offset(sreturn vma->vm_pgoff +PHYS_PFN (addr - vma->vm_start); } -#define VMG_STATE (name, mm_, vmi_, start_, end_, flags_, pgoff_) \ +#define VMG_STATE (name, mm_, vmi_, start_, end_, vm_flags_, pgoff_) \ struct vma_merge_struct name = { \ .mm = mm_, \ .vmi = vmi_, \ .start = start_, \ .end = end_, \ - .flags = flags_, \ + .vm_flags = vm_flags_, \ .pgoff = pgoff_, \ .state = VMA_MERGE_START, \ }
@@ -184,7 +184,7 @@ static inline pgoff_t vma_pgoff_offset(s .next = NULL, \ .start = start_, \ .end = end_, \ - .flags = vma_->vm_flags, \ + .vm_flags = vma_->vm_flags, \ .pgoff = vma_pgoff_offset(vma_, start_), \ .file = vma_->vm_file, \ .anon_vma = vma_->anon_vma, \
@@ -288,7 +288,7 @@ __must_check struct vm_area_struct *vma_modify_flags(struct vma_iterator *vmi, struct vm_area_struct *prev, struct vm_area_struct *vma, unsigned long start, unsigned long end, - unsigned long new_flags); + vm_flags_t vm_flags);/* We are about to modify the VMA's flags and/or anon_name. */ __must_check struct vm_area_struct
@@ -297,7 +297,7 @@ __must_check struct vm_area_structstruct vm_area_struct *vma, unsigned long start, unsigned long end, - unsigned long new_flags, + vm_flags_t vm_flags, struct anon_vma_name *new_name);/* We are about to modify the VMA's memory policy. */
@@ -314,7 +314,7 @@ __must_check struct vm_area_structstruct vm_area_struct *prev, struct vm_area_struct *vma, unsigned long start, unsigned long end, - unsigned long new_flags, + vm_flags_t vm_flags, struct vm_userfaultfd_ctx new_ctx, bool give_up_on_oom);
@@ -375,7 +375,7 @@ static inline bool vma_wants_manual_pte_ }#ifdef CONFIG_MMU -static inline pgprot_t vm_pgprot_modify (pgprot_t oldprot,unsigned long vm_flags) +static inline pgprot_t vm_pgprot_modify (pgprot_t oldprot,vm_flags_t vm_flags) {return pgprot_modify (oldprot,vm_get_page_prot (vm_flags)); }
mm/vmscan.c renamed from mm/vmscan.c~mm-update-core-kernel-code-to-use-vm_flags_t-consistently +2 -2
@@ -907,7 +907,7 @@ static enum folio_references folio_check struct scan_control *sc) {int referenced_ptes, referenced_folio; -unsigned long vm_flags; +vm_flags_t vm_flags; referenced_ptes =folio_referenced (folio,1 , sc->target_mem_cgroup, &vm_flags);
@@ -2120,7 +2120,7 @@ static void shrink_active_list(unsigned {unsigned long nr_taken;unsigned long nr_scanned; -unsigned long vm_flags; +vm_flags_t vm_flags;LIST_HEAD (l_hold);/* The folios which were snipped off */ LIST_HEAD (l_active);LIST_HEAD (l_inactive);
tools/testing/vma/vma.c renamed from tools/testing/vma/vma.c~mm-update-core-kernel-code-to-use-vm_flags_t-consistently +133 -133
742 lines not on this page · raw message
tools/testing/vma/vma_internal.h renamed from tools/testing/vma/vma_internal.h~mm-update-core-kernel-code-to-use-vm_flags_t-consistently +4 -4
@@ -1084,7 +1084,7 @@ static inline bool mpol_equal(struct mem }static inline void khugepaged_enter_vma (struct vm_area_struct *vma, -unsigned long vm_flags) +vm_flags_t vm_flags) { (void )vma; (void )vm_flags;
@@ -1200,7 +1200,7 @@ bool vma_wants_writenotify(struct vm_are/* Update vma->vm_page_prot to reflect vma->vm_flags. */ static inline void vma_set_page_prot (struct vm_area_struct *vma) { -unsigned long vm_flags = vma->vm_flags; +vm_flags_t vm_flags = vma->vm_flags;pgprot_t vm_page_prot;/* testing: we inline vm_pgprot_modify() to avoid clash with vma.h. */
@@ -1280,12 +1280,12 @@ static inline bool capable(int cap)return true; } -static inline bool mlock_future_ok (struct mm_struct *mm,unsigned long flags, +static inline bool mlock_future_ok (struct mm_struct *mm,vm_flags_t vm_flags,unsigned long bytes) {unsigned long locked_pages, limit_pages; -if (!(flags &VM_LOCKED ) ||capable (CAP_IPC_LOCK )) +if (!(vm_flags &VM_LOCKED ) ||capable (CAP_IPC_LOCK ))return true; locked_pages = bytes >>PAGE_SHIFT ;
_
Patches currently in -mm which might be from [email protected] are
mm-madvise-remove-the-visitor-pattern-and-thread-anon_vma-state.patch mm-madvise-thread-mm_struct-through-madvise_behavior.patch mm-madvise-thread-vma-range-state-through-madvise_behavior.patch mm-madvise-thread-all-madvise-state-through-madv_behavior.patch mm-madvise-eliminate-very-confusing-manipulation-of-prev-vma.patch mm-madvise-eliminate-very-confusing-manipulation-of-prev-vma-fix.patch tools-testing-selftests-add-mremap-unfaulted-faulted-test-cases.patch mm-mremap-perform-some-simple-cleanups.patch mm-mremap-refactor-initial-parameter-sanity-checks.patch mm-mremap-put-vma-check-and-prep-logic-into-helper-function.patch mm-mremap-cleanup-post-processing-stage-of-mremap.patch mm-mremap-use-an-explicit-uffd-failure-path-for-mremap.patch mm-mremap-use-an-explicit-uffd-failure-path-for-mremap-fix.patch mm-mremap-check-remap-conditions-earlier.patch mm-mremap-move-remap_is_valid-into-check_prep_vma.patch mm-mremap-clean-up-mlock-populate-behaviour.patch mm-mremap-permit-mremap-move-of-multiple-vmas.patch tools-testing-selftests-extend-mremap_test-to-test-multi-vma-mremap.patch