mm: continue vma_flags_t conversion
Subsystems (29)
Lorenzo Stoakes (ARM)
maintainerv2 cover mm: continue vma_flags_t conversion
Continue the conversion of legacy vm_flags_t flags to the new vma_flags_t bitmap type.
Do some more core mm conversion (we really should be the first to completely move to the new scheme :), but also update some mm-adjacent and otherwise straightforward cases - /proc/$pid/maps and friends, the coredump VMA dump size logic, uprobes, perf and LSM mmap/mprotect hooks.
This series only makes strictly mechanical changes to keep things gentle during this very busy cycle.
No functional change intended.
Build tested on x86-64 (allmodconfig, each patch individually), i386, arm64, riscv nommu and ppc64le.
---
v2:
* Dropped what were 1/13, 3/13, 4/13, 5/13 and 6/13, as David has taken these through mm/core.git.
* Rebased on mm-new.
* Updated 1/11 (was 2/13) to read VMA_RAND_READ_BIT before maybe_unlock_mmap_for_io() can release the fault lock, avoiding a use-after-free of the VMA, and to remove the now-shadowing inner VMA declaration, as per Sashiko and Andrew.
* Updated 2/11 (was 7/13) to drop an unrelated whitespace change in mm/ksm.c and to fix up the indentation of touched lines, as per David.
* Updated 3/11 (was 8/13) to retain the shadow stack check since added to hmm_vma_walk_test().
* Updated 4/11 (was 9/13) commit message to note that the soft-dirty assert in vm_flags_clear() is intentionally dropped, as per Lance.
* Split what was 13/13 into per-LSM patches 8/11 to 11/11, as per Paul.
* Propagated tags, thanks everyone!
v1:
https://lore.kernel.org/r/[email protected]
---
Lorenzo Stoakes (ARM) (11):
mm/filemap: convert fault and readahead logic to use vma_flags_t mm/madvise: convert madvise_vma_behavior() to use vma_flags_t
mm: convert miscellaneous VMA flag tests to use vma_flags_t fs/proc/task_mmu: convert VMA flag tests to use vma_flags_t fs/coredump: convert vma_dump_size() to use vma_flags_t
uprobes: convert VMA flag tests to use vma_flags_t
perf: convert VMA flag tests to use vma_flags_t
selinux: convert VMA flag tests to use vma_flags_t
apparmor: convert VMA flag tests to use vma_flags_t
ima: convert VMA flag tests to use vma_flags_t
ipe: convert VMA flag tests to use vma_flags_t
arch/powerpc/kvm/book3s_hv_uvmem.c | 10 ++++---- fs/coredump.c | 16 ++++++------- fs/proc/task_mmu.c | 43 +++++++++++++++++---------------- include/linux/huge_mm.h | 4 ++-- include/linux/ksm.h | 4 ++-- include/linux/mm_inline.h | 2 +- kernel/events/core.c | 26 ++++++++++---------- kernel/events/uprobes.c | 12 ++++++---- lib/test_hmm.c | 4 ++-- mm/damon/vaddr.c | 2 +- mm/filemap.c | 26 ++++++++++---------- mm/hmm.c | 6 ++--- mm/internal.h | 2 +- mm/khugepaged.c | 10 ++++---- mm/ksm.c | 8 +++---- mm/madvise.c | 49 ++++++++++++++++++++------------------ mm/mempolicy.c | 4 ++-- mm/mmap_lock.c | 4 ++-- mm/mremap.c | 2 +- mm/msync.c | 4 ++-- mm/oom_kill.c | 4 ++-- mm/pagewalk.c | 2 +- mm/vma.h | 4 ++-- security/apparmor/lsm.c | 2 +- security/integrity/ima/ima_main.c | 2 +- security/ipe/hooks.c | 2 +- security/selinux/hooks.c | 14 +++++------ 27 files changed, 139 insertions(+), 129 deletions(-)
---
base-commit: 5bd93e4b0b357e9d0a13199887aacbf04d1ce216
change-id: 20261101-late-2026-vma-flags-461731a636c3
Cheers,
Signature · 1 line
Lorenzo Stoakes (ARM) <[email protected]>
Lorenzo Stoakes (ARM)
maintainerPATCH v2 1/11 mm/filemap: convert fault and readahead logic to use vma_flags_t
Replace use of the legacy vm_flags_t flags with vma_flags_t values in the file fault and mmap readahead logic.
No functional change intended.
--- mm/filemap.c | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-)
mm/filemap.c +14 -12
@@ -3359,13 +3359,14 @@ static struct file *do_sync_mmap_readahead(struct vm_fault *vmf)struct address_space *mapping = file->f_mapping;DEFINE_READAHEAD (ractl, file, ra, mapping, vmf->pgoff);struct file *fpin =NULL ; -vm_flags_t vm_flags = vmf->vma->vm_flags; +struct vm_area_struct *vma = vmf->vma;bool force_thp_readahead = false;unsigned int thp_order =0 ;unsigned short mmap_miss;/* Use the readahead code, even if readahead is disabled */ -if (IS_ENABLED (CONFIG_TRANSPARENT_HUGEPAGE ) && (vm_flags &VM_HUGEPAGE )) { +if (IS_ENABLED (CONFIG_TRANSPARENT_HUGEPAGE ) && +vma_test (vma,VMA_HUGEPAGE_BIT )) {/* * Cap max THP order at 2MB: this is the common PMD-sized * hugepage size, and it avoids memory pressure from very
@@ -3385,20 +3386,21 @@ static struct file *do_sync_mmap_readahead(struct vm_fault *vmf)* If we don't want any read-ahead, don't bother. * VM_EXEC case below is already intended for random access. */ -if ((vm_flags & (VM_RAND_READ |VM_EXEC )) ==VM_RAND_READ ) +if (vma_test (vma,VMA_RAND_READ_BIT ) && + !vma_test (vma,VMA_EXEC_BIT ))return fpin;if (!ra->ra_pages)return fpin; -if (vm_flags &VM_SEQ_READ ) { +if (vma_test (vma,VMA_SEQ_READ_BIT )) { fpin =maybe_unlock_mmap_for_io (vmf, fpin);page_cache_sync_ra (&ractl, ra->ra_pages);return fpin; } } -if (!(vm_flags & (VM_SEQ_READ |VM_EXEC ))) { +if (!vma_test_any (vma,VMA_SEQ_READ_BIT ,VMA_EXEC_BIT )) {/* Avoid banging the cache line if not needed */ mmap_miss =READ_ONCE (ra->mmap_miss);if (mmap_miss <MMAP_LOTSAMISS *10 )
@@ -3414,6 +3416,7 @@ static struct file *do_sync_mmap_readahead(struct vm_fault *vmf)if (force_thp_readahead) {unsigned long folio_nr_pages =1UL << thp_order; +const bool random_read =vma_test (vma,VMA_RAND_READ_BIT ); fpin =maybe_unlock_mmap_for_io (vmf, fpin); ractl._index &= ~(folio_nr_pages -1 );
@@ -3422,7 +3425,7 @@ static struct file *do_sync_mmap_readahead(struct vm_fault *vmf)* Fetch two folios so we get the chance to actually * readahead, unless we've been told not to. */ -if (!(vm_flags &VM_RAND_READ )) +if (!random_read) ra->size *=2 ; ra->async_size = folio_nr_pages; ra->order = thp_order;
@@ -3430,7 +3433,7 @@ static struct file *do_sync_mmap_readahead(struct vm_fault *vmf)return fpin; } -if (vm_flags &VM_EXEC ) { +if (vma_test (vma,VMA_EXEC_BIT )) {/* * Allow arch to request a preferred minimum folio order for * executable memory. This can often be beneficial to
@@ -3442,7 +3445,6 @@ static struct file *do_sync_mmap_readahead(struct vm_fault *vmf)* pad that might exist between sections, which would be a waste * of memory. */ -struct vm_area_struct *vma = vmf->vma;const unsigned long start =vma_start_pgoff (vma);const unsigned long end =vma_end_pgoff (vma);unsigned long ra_end;
@@ -3485,7 +3487,7 @@ static struct file *do_async_mmap_readahead(struct vm_fault *vmf,unsigned short mmap_miss;/* If we don't want any read-ahead, don't bother */ -if (vmf->vma->vm_flags &VM_RAND_READ || !ra->ra_pages) +if (vma_test (vmf->vma,VMA_RAND_READ_BIT ) || !ra->ra_pages)return fpin;/*
@@ -3499,7 +3501,7 @@ static struct file *do_async_mmap_readahead(struct vm_fault *vmf,* keep the counter symmetric. */ if (likely (!folio_test_locked (folio)) && - !(vmf->vma->vm_flags & (VM_SEQ_READ |VM_EXEC ))) { + !vma_test_any (vmf->vma,VMA_SEQ_READ_BIT ,VMA_EXEC_BIT )) { mmap_miss =READ_ONCE (ra->mmap_miss);if (mmap_miss)WRITE_ONCE (ra->mmap_miss, --mmap_miss);
@@ -3532,7 +3534,7 @@ static vm_fault_t filemap_fault_recheck_pte_none(struct vm_fault *vmf)* scenarios. Recheck the PTE without PT lock firstly, thereby reducing * the number of times we hold PT lock. */ -if (!(vma->vm_flags &VM_LOCKED )) +if (!vma_test (vma,VMA_LOCKED_BIT ))return 0 ;if (!(vmf->flags &FAULT_FLAG_ORIG_PTE_VALID ))
@@ -4018,7 +4020,7 @@ vm_fault_t filemap_map_pages(struct vm_fault *vmf,if ((map_ret &VM_FAULT_NOPAGE ) && !(vmf->flags &FAULT_FLAG_TRIED ) && !folio_test_workingset (folio) && - !(vma->vm_flags & (VM_SEQ_READ |VM_EXEC ))) { + !vma_test_any (vma,VMA_SEQ_READ_BIT ,VMA_EXEC_BIT )) {unsigned short mmap_miss; mmap_miss =READ_ONCE (file->f_ra.mmap_miss);
Signature · 1 line
2.56.1
Re: [PATCH v2 01/11] mm/filemap: convert fault and readahead logic to use vma_flags_t
Quoted 7 lines · Lorenzo Stoakes (ARM)
Replace use of the legacy
vm_flags_tflags withvma_flags_tvalues in the file fault and mmap readahead logic.No functional change intended.
Signed-off-by Lorenzo Stoakes (ARM) <[email protected]>Reviewed-by Barry Song <[email protected]>
Looks good. Feel free to add:
Honza
Quoted 124 lines
--- mm/filemap.c | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-)mm/filemap.c +14
-12@@ -3359,13 +3359,14 @@ static struct file *do_sync_mmap_readahead(struct vm_fault *vmf)struct address_space *mapping = file->f_mapping;DEFINE_READAHEAD (ractl, file, ra, mapping, vmf->pgoff);struct file *fpin =NULL ; -vm_flags_t vm_flags = vmf->vma->vm_flags; +struct vm_area_struct *vma = vmf->vma;bool force_thp_readahead = false;unsigned int thp_order =0 ;unsigned short mmap_miss;/* Use the readahead code, even if readahead is disabled */ -if (IS_ENABLED (CONFIG_TRANSPARENT_HUGEPAGE ) && (vm_flags &VM_HUGEPAGE )) { +if (IS_ENABLED (CONFIG_TRANSPARENT_HUGEPAGE ) && +vma_test (vma,VMA_HUGEPAGE_BIT )) {/* * Cap max THP order at 2MB: this is the common PMD-sized * hugepage size, and it avoids memory pressure from very @@ -3385,20 +3386,21 @@ static struct file *do_sync_mmap_readahead(struct vm_fault *vmf)* If we don't want any read-ahead, don't bother. * VM_EXEC case below is already intended for random access. */ -if ((vm_flags & (VM_RAND_READ |VM_EXEC )) ==VM_RAND_READ ) +if (vma_test (vma,VMA_RAND_READ_BIT ) && + !vma_test (vma,VMA_EXEC_BIT ))return fpin;if (!ra->ra_pages)return fpin; -if (vm_flags &VM_SEQ_READ ) { +if (vma_test (vma,VMA_SEQ_READ_BIT )) { fpin =maybe_unlock_mmap_for_io (vmf, fpin);page_cache_sync_ra (&ractl, ra->ra_pages);return fpin; } } -if (!(vm_flags & (VM_SEQ_READ |VM_EXEC ))) { +if (!vma_test_any (vma,VMA_SEQ_READ_BIT ,VMA_EXEC_BIT )) {/* Avoid banging the cache line if not needed */ mmap_miss =READ_ONCE (ra->mmap_miss);if (mmap_miss <MMAP_LOTSAMISS *10 )@@ -3414,6 +3416,7 @@ static struct file *do_sync_mmap_readahead(struct vm_fault *vmf)if (force_thp_readahead) {unsigned long folio_nr_pages =1UL << thp_order; +const bool random_read =vma_test (vma,VMA_RAND_READ_BIT ); fpin =maybe_unlock_mmap_for_io (vmf, fpin); ractl._index &= ~(folio_nr_pages -1 );@@ -3422,7 +3425,7 @@ static struct file *do_sync_mmap_readahead(struct vm_fault *vmf)* Fetch two folios so we get the chance to actually * readahead, unless we've been told not to. */ -if (!(vm_flags &VM_RAND_READ )) +if (!random_read) ra->size *=2 ; ra->async_size = folio_nr_pages; ra->order = thp_order;@@ -3430,7 +3433,7 @@ static struct file *do_sync_mmap_readahead(struct vm_fault *vmf)return fpin; } -if (vm_flags &VM_EXEC ) { +if (vma_test (vma,VMA_EXEC_BIT )) {/* * Allow arch to request a preferred minimum folio order for * executable memory. This can often be beneficial to @@ -3442,7 +3445,6 @@ static struct file *do_sync_mmap_readahead(struct vm_fault *vmf)* pad that might exist between sections, which would be a waste * of memory. */ -struct vm_area_struct *vma = vmf->vma;const unsigned long start =vma_start_pgoff (vma);const unsigned long end =vma_end_pgoff (vma);unsigned long ra_end;@@ -3485,7 +3487,7 @@ static struct file *do_async_mmap_readahead(struct vm_fault *vmf,unsigned short mmap_miss;/* If we don't want any read-ahead, don't bother */ -if (vmf->vma->vm_flags &VM_RAND_READ || !ra->ra_pages) +if (vma_test (vmf->vma,VMA_RAND_READ_BIT ) || !ra->ra_pages)return fpin;/* @@ -3499,7 +3501,7 @@ static struct file *do_async_mmap_readahead(struct vm_fault *vmf,* keep the counter symmetric. */ if (likely (!folio_test_locked (folio)) && - !(vmf->vma->vm_flags & (VM_SEQ_READ |VM_EXEC ))) { + !vma_test_any (vmf->vma,VMA_SEQ_READ_BIT ,VMA_EXEC_BIT )) { mmap_miss =READ_ONCE (ra->mmap_miss);if (mmap_miss)WRITE_ONCE (ra->mmap_miss, --mmap_miss);@@ -3532,7 +3534,7 @@ static vm_fault_t filemap_fault_recheck_pte_none(struct vm_fault *vmf)* scenarios. Recheck the PTE without PT lock firstly, thereby reducing * the number of times we hold PT lock. */ -if (!(vma->vm_flags &VM_LOCKED )) +if (!vma_test (vma,VMA_LOCKED_BIT ))return 0 ;if (!(vmf->flags &FAULT_FLAG_ORIG_PTE_VALID ))@@ -4018,7 +4020,7 @@ vm_fault_t filemap_map_pages(struct vm_fault *vmf,if ((map_ret &VM_FAULT_NOPAGE ) && !(vmf->flags &FAULT_FLAG_TRIED ) && !folio_test_workingset (folio) && - !(vma->vm_flags & (VM_SEQ_READ |VM_EXEC ))) { + !vma_test_any (vma,VMA_SEQ_READ_BIT ,VMA_EXEC_BIT )) {unsigned short mmap_miss; mmap_miss =READ_ONCE (file->f_ra.mmap_miss);Signature · 2 lines
-- 2.56.1
Signature · 2 lines
Jan Kara <[email protected]> SUSE Labs, CR
+ mm-filemap-convert-fault-and-readahead-logic-to-use-vma_flags_t.patch added to mm-new branch
In reply to Lorenzo Stoakes (ARM)The patch titled Subject: mm/filemap: convert fault and readahead logic to use vma_flags_t has been added to the -mm mm-new branch. Its filename is…
The patch titled
Subject: mm/filemap: convert fault and readahead logic to use vma_flags_t
has been added to the -mm mm-new branch. Its filename is
mm-filemap-convert-fault-and-readahead-logic-to-use-vma_flags_t.patch
This patch will shortly appear at
https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-filemap-convert-fault-and-readahead-logic-to-use-vma_flags_t.patch
This patch will later appear in the mm-new branch at
git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Note, mm-new is a provisional staging ground for work-in-progress patches, and acceptance into mm-new is a notification for others take notice and to finish up reviews. Please do not hesitate to respond to review feedback and post updated versions to replace or incrementally fixup patches in mm-new.
The mm-new branch of mm.git is not included in linux-next
If a few days of testing in mm-new is successful, the patch will me moved into mm.git's mm-unstable branch, which is included in linux-next
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next via various branches at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there most days
------------------------------------------------------
From: "Lorenzo Stoakes (ARM)" <[email protected]>
Subject: mm/filemap: convert fault and readahead logic to use vma_flags_t
Date: Tue, 24 Nov 2026 17:07:53 +0000
Patch series "mm: continue vma_flags_t conversion", v2.
Continue the conversion of legacy vm_flags_t flags to the new vma_flags_t bitmap type.
Do some more core mm conversion (we really should be the first to completely move to the new scheme :), but also update some mm-adjacent and otherwise straightforward cases - /proc/$pid/maps and friends, the coredump VMA dump size logic, uprobes, perf and LSM mmap/mprotect hooks.
This series only makes strictly mechanical changes to keep things gentle during this very busy cycle.
No functional change intended.
This patch (of 11):
Replace use of the legacy vm_flags_t flags with vma_flags_t values in the file fault and mmap readahead logic.
No functional change intended.
mm/filemap.c | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-)
mm/filemap.c renamed from mm/filemap.c~mm-filemap-convert-fault-and-readahead-logic-to-use-vma_flags_t +14 -12
@@ -3359,13 +3359,14 @@ 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 ; -vm_flags_t vm_flags = vmf->vma->vm_flags; +struct vm_area_struct *vma = vmf->vma;bool force_thp_readahead = false;unsigned int thp_order =0 ;unsigned short mmap_miss;/* Use the readahead code, even if readahead is disabled */ -if (IS_ENABLED (CONFIG_TRANSPARENT_HUGEPAGE ) && (vm_flags &VM_HUGEPAGE )) { +if (IS_ENABLED (CONFIG_TRANSPARENT_HUGEPAGE ) && +vma_test (vma,VMA_HUGEPAGE_BIT )) {/* * Cap max THP order at 2MB: this is the common PMD-sized * hugepage size, and it avoids memory pressure from very
@@ -3385,20 +3386,21 @@ static struct file *do_sync_mmap_readahe* If we don't want any read-ahead, don't bother. * VM_EXEC case below is already intended for random access. */ -if ((vm_flags & (VM_RAND_READ |VM_EXEC )) ==VM_RAND_READ ) +if (vma_test (vma,VMA_RAND_READ_BIT ) && + !vma_test (vma,VMA_EXEC_BIT ))return fpin;if (!ra->ra_pages)return fpin; -if (vm_flags &VM_SEQ_READ ) { +if (vma_test (vma,VMA_SEQ_READ_BIT )) { fpin =maybe_unlock_mmap_for_io (vmf, fpin);page_cache_sync_ra (&ractl, ra->ra_pages);return fpin; } } -if (!(vm_flags & (VM_SEQ_READ |VM_EXEC ))) { +if (!vma_test_any (vma,VMA_SEQ_READ_BIT ,VMA_EXEC_BIT )) {/* Avoid banging the cache line if not needed */ mmap_miss =READ_ONCE (ra->mmap_miss);if (mmap_miss <MMAP_LOTSAMISS *10 )
@@ -3414,6 +3416,7 @@ static struct file *do_sync_mmap_readaheif (force_thp_readahead) {unsigned long folio_nr_pages =1UL << thp_order; +const bool random_read =vma_test (vma,VMA_RAND_READ_BIT ); fpin =maybe_unlock_mmap_for_io (vmf, fpin); ractl._index &= ~(folio_nr_pages -1 );
@@ -3422,7 +3425,7 @@ static struct file *do_sync_mmap_readahe* Fetch two folios so we get the chance to actually * readahead, unless we've been told not to. */ -if (!(vm_flags &VM_RAND_READ )) +if (!random_read) ra->size *=2 ; ra->async_size = folio_nr_pages; ra->order = thp_order;
@@ -3430,7 +3433,7 @@ static struct file *do_sync_mmap_readahereturn fpin; } -if (vm_flags &VM_EXEC ) { +if (vma_test (vma,VMA_EXEC_BIT )) {/* * Allow arch to request a preferred minimum folio order for * executable memory. This can often be beneficial to
@@ -3442,7 +3445,6 @@ static struct file *do_sync_mmap_readahe* pad that might exist between sections, which would be a waste * of memory. */ -struct vm_area_struct *vma = vmf->vma;const unsigned long start =vma_start_pgoff (vma);const unsigned long end =vma_end_pgoff (vma);unsigned long ra_end;
@@ -3485,7 +3487,7 @@ static struct file *do_async_mmap_readahunsigned short mmap_miss;/* If we don't want any read-ahead, don't bother */ -if (vmf->vma->vm_flags &VM_RAND_READ || !ra->ra_pages) +if (vma_test (vmf->vma,VMA_RAND_READ_BIT ) || !ra->ra_pages)return fpin;/*
@@ -3499,7 +3501,7 @@ static struct file *do_async_mmap_readah* keep the counter symmetric. */ if (likely (!folio_test_locked (folio)) && - !(vmf->vma->vm_flags & (VM_SEQ_READ |VM_EXEC ))) { + !vma_test_any (vmf->vma,VMA_SEQ_READ_BIT ,VMA_EXEC_BIT )) { mmap_miss =READ_ONCE (ra->mmap_miss);if (mmap_miss)WRITE_ONCE (ra->mmap_miss, --mmap_miss);
@@ -3532,7 +3534,7 @@ static vm_fault_t filemap_fault_recheck_* scenarios. Recheck the PTE without PT lock firstly, thereby reducing * the number of times we hold PT lock. */ -if (!(vma->vm_flags &VM_LOCKED )) +if (!vma_test (vma,VMA_LOCKED_BIT ))return 0 ;if (!(vmf->flags &FAULT_FLAG_ORIG_PTE_VALID ))
@@ -4018,7 +4020,7 @@ vm_fault_t filemap_map_pages(struct vm_fif ((map_ret &VM_FAULT_NOPAGE ) && !(vmf->flags &FAULT_FLAG_TRIED ) && !folio_test_workingset (folio) && - !(vma->vm_flags & (VM_SEQ_READ |VM_EXEC ))) { + !vma_test_any (vma,VMA_SEQ_READ_BIT ,VMA_EXEC_BIT )) {unsigned short mmap_miss; mmap_miss =READ_ONCE (file->f_ra.mmap_miss);
_
Patches currently in -mm which might be from [email protected] are
mm-msync-return-enomem-if-page-aligned-length-overflows.patch mm-vma-drop-mm-asynchronously-in-vma_start_read.patch mm-vma-predicate-vma_assert_stabilised-on-config_debug_vm.patch mm-only-assert-mmap-locks-if-config_debug_vm-or-lockdep-is-set.patch mm-only-assert-vma-locks-if-config_debug_vm-is-set.patch mm-convert-warn_on_onces-to-vm_warn_on_once-in-vma-lock-code.patch mm-madvise-zap-markers-from-guard-regions.patch mm-mmap-free-gathered-pages-before-mmf_oom_skip.patch percpu-fix-contig-hints-that-are-too-low.patch percpu-search-the-whole-reserved-chunk.patch mm-filemap-convert-fault-and-readahead-logic-to-use-vma_flags_t.patch mm-madvise-convert-madvise_vma_behavior-to-use-vma_flags_t.patch mm-convert-miscellaneous-vma-flag-tests-to-use-vma_flags_t.patch fs-proc-task_mmu-convert-vma-flag-tests-to-use-vma_flags_t.patch fs-coredump-convert-vma_dump_size-to-use-vma_flags_t.patch uprobes-convert-vma-flag-tests-to-use-vma_flags_t.patch perf-convert-vma-flag-tests-to-use-vma_flags_t.patch selinux-convert-vma-flag-tests-to-use-vma_flags_t.patch apparmor-convert-vma-flag-tests-to-use-vma_flags_t.patch ima-convert-vma-flag-tests-to-use-vma_flags_t.patch ipe-convert-vma-flag-tests-to-use-vma_flags_t.patch
Lorenzo Stoakes (ARM)
maintainerPATCH v2 2/11 mm/madvise: convert madvise_vma_behavior() to use vma_flags_t
In reply to Lorenzo Stoakes (ARM)Replace use of the legacy vm_flags_t flags with vma_flags_t values throughout the madvise logic.
In order to do so, update ksm_madvise() and hugepage_madvise() to take a vma_flags_t pointer, and update their other callers in mremap and the powerpc KVM ultravisor code accordingly.
In the latter case we replace vm_flags_reset() with vma_overwrite_flags(). The VMA is write locked at this point, so the atomic flags preserved by vma_overwrite_flags() cannot differ from those copied, and the behaviour is unchanged.
No functional change intended.
--- arch/powerpc/kvm/book3s_hv_uvmem.c | 10 ++++---- include/linux/huge_mm.h | 4 ++-- include/linux/ksm.h | 4 ++-- mm/khugepaged.c | 10 ++++---- mm/ksm.c | 8 +++---- mm/madvise.c | 49 ++++++++++++++++++++------------------ mm/mremap.c | 2 +- 7 files changed, 45 insertions(+), 42 deletions(-)
arch/powerpc/kvm/book3s_hv_uvmem.c +5 -5
@@ -393,7 +393,7 @@ static int kvmppc_memslot_page_merge(struct kvm *kvm, {unsigned long gfn = memslot->base_gfn;unsigned long end, start =gfn_to_hva (kvm, gfn); -vm_flags_t vm_flags; +vma_flags_t vma_flags;int ret =0 ;struct vm_area_struct *vma;int merge_flag = (merge) ?MADV_MERGEABLE :MADV_UNMERGEABLE ;
@@ -411,15 +411,15 @@ static int kvmppc_memslot_page_merge(struct kvm *kvm,break ; }vma_start_write (vma); -/* Copy vm_flags to avoid partial modifications in ksm_madvise */ - vm_flags = vma->vm_flags; +/* Copy flags to avoid partial modifications in ksm_madvise */ + vma_flags = vma->flags; ret =ksm_madvise (vma, vma->vm_start, vma->vm_end, - merge_flag, &vm_flags); + merge_flag, &vma_flags);if (ret) { ret =H_STATE ;break ; } -vm_flags_reset (vma, vm_flags); +vma_overwrite_flags (vma, vma_flags); start = vma->vm_end; }while (end > vma->vm_end);
include/linux/huge_mm.h +2 -2
@@ -507,7 +507,7 @@ change_huge_pud(struct mmu_gather *tlb, struct vm_area_struct *vma,__split_huge_pud (__vma, __pud, __address); \ }while (0 ) -int hugepage_madvise(struct vm_area_struct *vma, vm_flags_t *vm_flags, +int hugepage_madvise(struct vm_area_struct *vma, vma_flags_t *vma_flags, int advice);int madvise_collapse (struct vm_area_struct *vma,unsigned long start,unsigned long end,bool *lock_dropped);
@@ -709,7 +709,7 @@ static inline bool unmap_huge_pmd_locked(struct vm_area_struct *vma, do { } while (0)static inline int hugepage_madvise (struct vm_area_struct *vma, -vm_flags_t *vm_flags,int advice) +vma_flags_t *vma_flags,int advice) {return -EINVAL ; }
include/linux/ksm.h +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,vm_flags_t *vm_flags); +unsigned long end,int advice,vma_flags_t *vma_flags);vma_flags_t ksm_vma_flags (struct mm_struct *mm,const struct file *file,vma_flags_t vma_flags);int ksm_enable_merge_any (struct mm_struct *mm);
@@ -139,7 +139,7 @@ static inline void collect_procs_ksm(const struct folio *folio,#ifdef CONFIG_MMU static inline int ksm_madvise (struct vm_area_struct *vma,unsigned long start, -unsigned long end,int advice,vm_flags_t *vm_flags) +unsigned long end,int advice,vma_flags_t *vma_flags) {return 0 ; }
mm/khugepaged.c +5 -5
@@ -363,16 +363,16 @@ static unsigned int collapse_max_ptes_swap(struct collapse_control *cc, }int hugepage_madvise (struct vm_area_struct *vma, -vm_flags_t *vm_flags,int advice) +vma_flags_t *vma_flags,int advice) {switch (advice) {case MADV_HUGEPAGE : - *vm_flags &= ~VM_NOHUGEPAGE ; - *vm_flags |=VM_HUGEPAGE ; +vma_flags_clear (vma_flags,VMA_NOHUGEPAGE_BIT ); +vma_flags_set (vma_flags,VMA_HUGEPAGE_BIT );break ;case MADV_NOHUGEPAGE : - *vm_flags &= ~VM_HUGEPAGE ; - *vm_flags |=VM_NOHUGEPAGE ; +vma_flags_clear (vma_flags,VMA_HUGEPAGE_BIT ); +vma_flags_set (vma_flags,VMA_NOHUGEPAGE_BIT );/* * Setting VM_NOHUGEPAGE will prevent khugepaged from scanning * this vma even if we leave the mm registered in khugepaged if
mm/ksm.c +4 -4
@@ -3022,7 +3022,7 @@ int ksm_disable(struct mm_struct *mm) }int ksm_madvise (struct vm_area_struct *vma,unsigned long start, -unsigned long end,int advice,vm_flags_t *vm_flags) +unsigned long end,int advice,vma_flags_t *vma_flags) {struct mm_struct *mm = vma->vm_mm;int err;
@@ -3040,11 +3040,11 @@ int ksm_madvise(struct vm_area_struct *vma, unsigned long start,return err; } - *vm_flags |=VM_MERGEABLE ; +vma_flags_set (vma_flags,VMA_MERGEABLE_BIT );break ;case MADV_UNMERGEABLE : -if (!(*vm_flags &VM_MERGEABLE )) +if (!vma_flags_test (vma_flags,VMA_MERGEABLE_BIT ))return 0 ;/* just ignore the advice */ if (vma_has_anon_rmap (vma)) {
@@ -3053,7 +3053,7 @@ int ksm_madvise(struct vm_area_struct *vma, unsigned long start,return err; } - *vm_flags &= ~VM_MERGEABLE ; +vma_flags_clear (vma_flags,VMA_MERGEABLE_BIT );break ; }
mm/madvise.c +26 -23
129 lines not on this page · raw message
mm/mremap.c +1 -1
@@ -1131,7 +1131,7 @@ static unsigned long prep_move_vma(struct vma_remap_struct *vrm)struct vm_area_struct *vma = vrm->vma;unsigned long old_addr = vrm->addr;unsigned long old_len = vrm->old_len; -vm_flags_t dummy = vma->vm_flags; +vma_flags_t dummy = vma->flags;const bool split_before = vma->vm_start != old_addr;const bool split_after = vma->vm_end != old_addr + old_len;
Signature · 1 line
2.56.1
+ mm-madvise-convert-madvise_vma_behavior-to-use-vma_flags_t.patch added to mm-new branch
The patch titled Subject: mm/madvise: convert madvise_vma_behavior() to use vma_flags_t has been added to the -mm mm-new branch. Its filename is…
The patch titled
Subject: mm/madvise: convert madvise_vma_behavior() to use vma_flags_t
has been added to the -mm mm-new branch. Its filename is
mm-madvise-convert-madvise_vma_behavior-to-use-vma_flags_t.patch
This patch will shortly appear at
https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-madvise-convert-madvise_vma_behavior-to-use-vma_flags_t.patch
This patch will later appear in the mm-new branch at
git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Note, mm-new is a provisional staging ground for work-in-progress patches, and acceptance into mm-new is a notification for others take notice and to finish up reviews. Please do not hesitate to respond to review feedback and post updated versions to replace or incrementally fixup patches in mm-new.
The mm-new branch of mm.git is not included in linux-next
If a few days of testing in mm-new is successful, the patch will me moved into mm.git's mm-unstable branch, which is included in linux-next
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next via various branches at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there most days
------------------------------------------------------
From: "Lorenzo Stoakes (ARM)" <[email protected]>
Subject: mm/madvise: convert madvise_vma_behavior() to use vma_flags_t
Date: Tue, 24 Nov 2026 17:07:54 +0000
Replace use of the legacy vm_flags_t flags with vma_flags_t values throughout the madvise logic.
In order to do so, update ksm_madvise() and hugepage_madvise() to take a vma_flags_t pointer, and update their other callers in mremap and the powerpc KVM ultravisor code accordingly.
In the latter case we replace vm_flags_reset() with vma_overwrite_flags(). The VMA is write locked at this point, so the atomic flags preserved by vma_overwrite_flags() cannot differ from those copied, and the behaviour is unchanged.
No functional change intended.
arch/powerpc/kvm/book3s_hv_uvmem.c | 10 ++--- include/linux/huge_mm.h | 4 +- include/linux/ksm.h | 4 +- mm/khugepaged.c | 10 ++--- mm/ksm.c | 8 ++-- mm/madvise.c | 49 ++++++++++++++------------- mm/mremap.c | 2 - 7 files changed, 45 insertions(+), 42 deletions(-)
arch/powerpc/kvm/book3s_hv_uvmem.c renamed from arch/powerpc/kvm/book3s_hv_uvmem.c~mm-madvise-convert-madvise_vma_behavior-to-use-vma_flags_t +5 -5
@@ -393,7 +393,7 @@ static int kvmppc_memslot_page_merge(str {unsigned long gfn = memslot->base_gfn;unsigned long end, start =gfn_to_hva (kvm, gfn); -vm_flags_t vm_flags; +vma_flags_t vma_flags;int ret =0 ;struct vm_area_struct *vma;int merge_flag = (merge) ?MADV_MERGEABLE :MADV_UNMERGEABLE ;
@@ -411,15 +411,15 @@ static int kvmppc_memslot_page_merge(strbreak ; }vma_start_write (vma); -/* Copy vm_flags to avoid partial modifications in ksm_madvise */ - vm_flags = vma->vm_flags; +/* Copy flags to avoid partial modifications in ksm_madvise */ + vma_flags = vma->flags; ret =ksm_madvise (vma, vma->vm_start, vma->vm_end, - merge_flag, &vm_flags); + merge_flag, &vma_flags);if (ret) { ret =H_STATE ;break ; } -vm_flags_reset (vma, vm_flags); +vma_overwrite_flags (vma, vma_flags); start = vma->vm_end; }while (end > vma->vm_end);
include/linux/huge_mm.h renamed from include/linux/huge_mm.h~mm-madvise-convert-madvise_vma_behavior-to-use-vma_flags_t +2 -2
@@ -507,7 +507,7 @@ change_huge_pud(struct mmu_gather *tlb,__split_huge_pud (__vma, __pud, __address); \ }while (0 ) -int hugepage_madvise(struct vm_area_struct *vma, vm_flags_t *vm_flags, +int hugepage_madvise(struct vm_area_struct *vma, vma_flags_t *vma_flags, int advice);int madvise_collapse (struct vm_area_struct *vma,unsigned long start,unsigned long end,bool *lock_dropped);
@@ -709,7 +709,7 @@ static inline bool unmap_huge_pmd_locked do { } while (0)static inline int hugepage_madvise (struct vm_area_struct *vma, -vm_flags_t *vm_flags,int advice) +vma_flags_t *vma_flags,int advice) {return -EINVAL ; }
include/linux/ksm.h renamed from include/linux/ksm.h~mm-madvise-convert-madvise_vma_behavior-to-use-vma_flags_t +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,vm_flags_t *vm_flags); +unsigned long end,int advice,vma_flags_t *vma_flags);vma_flags_t ksm_vma_flags (struct mm_struct *mm,const struct file *file,vma_flags_t vma_flags);int ksm_enable_merge_any (struct mm_struct *mm);
@@ -139,7 +139,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,vm_flags_t *vm_flags) +unsigned long end,int advice,vma_flags_t *vma_flags) {return 0 ; }
mm/khugepaged.c renamed from mm/khugepaged.c~mm-madvise-convert-madvise_vma_behavior-to-use-vma_flags_t +5 -5
@@ -363,16 +363,16 @@ static unsigned int collapse_max_ptes_sw }int hugepage_madvise (struct vm_area_struct *vma, -vm_flags_t *vm_flags,int advice) +vma_flags_t *vma_flags,int advice) {switch (advice) {case MADV_HUGEPAGE : - *vm_flags &= ~VM_NOHUGEPAGE ; - *vm_flags |=VM_HUGEPAGE ; +vma_flags_clear (vma_flags,VMA_NOHUGEPAGE_BIT ); +vma_flags_set (vma_flags,VMA_HUGEPAGE_BIT );break ;case MADV_NOHUGEPAGE : - *vm_flags &= ~VM_HUGEPAGE ; - *vm_flags |=VM_NOHUGEPAGE ; +vma_flags_clear (vma_flags,VMA_HUGEPAGE_BIT ); +vma_flags_set (vma_flags,VMA_NOHUGEPAGE_BIT );/* * Setting VM_NOHUGEPAGE will prevent khugepaged from scanning * this vma even if we leave the mm registered in khugepaged if
mm/ksm.c renamed from mm/ksm.c~mm-madvise-convert-madvise_vma_behavior-to-use-vma_flags_t +4 -4
@@ -3022,7 +3022,7 @@ int ksm_disable(struct mm_struct *mm) }int ksm_madvise (struct vm_area_struct *vma,unsigned long start, -unsigned long end,int advice,vm_flags_t *vm_flags) +unsigned long end,int advice,vma_flags_t *vma_flags) {struct mm_struct *mm = vma->vm_mm;int err;
@@ -3040,11 +3040,11 @@ int ksm_madvise(struct vm_area_struct *vreturn err; } - *vm_flags |=VM_MERGEABLE ; +vma_flags_set (vma_flags,VMA_MERGEABLE_BIT );break ;case MADV_UNMERGEABLE : -if (!(*vm_flags &VM_MERGEABLE )) +if (!vma_flags_test (vma_flags,VMA_MERGEABLE_BIT ))return 0 ;/* just ignore the advice */ if (vma_has_anon_rmap (vma)) {
@@ -3053,7 +3053,7 @@ int ksm_madvise(struct vm_area_struct *vreturn err; } - *vm_flags &= ~VM_MERGEABLE ; +vma_flags_clear (vma_flags,VMA_MERGEABLE_BIT );break ; }
mm/madvise.c renamed from mm/madvise.c~mm-madvise-convert-madvise_vma_behavior-to-use-vma_flags_t +26 -23
129 lines not on this page · raw message
mm/mremap.c renamed from mm/mremap.c~mm-madvise-convert-madvise_vma_behavior-to-use-vma_flags_t +1 -1
@@ -1131,7 +1131,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; -vm_flags_t dummy = vma->vm_flags; +vma_flags_t dummy = vma->flags;const bool split_before = vma->vm_start != old_addr;const bool split_after = vma->vm_end != old_addr + old_len;
_
Patches currently in -mm which might be from [email protected] are
mm-msync-return-enomem-if-page-aligned-length-overflows.patch mm-vma-drop-mm-asynchronously-in-vma_start_read.patch mm-vma-predicate-vma_assert_stabilised-on-config_debug_vm.patch mm-only-assert-mmap-locks-if-config_debug_vm-or-lockdep-is-set.patch mm-only-assert-vma-locks-if-config_debug_vm-is-set.patch mm-convert-warn_on_onces-to-vm_warn_on_once-in-vma-lock-code.patch mm-madvise-zap-markers-from-guard-regions.patch mm-mmap-free-gathered-pages-before-mmf_oom_skip.patch percpu-fix-contig-hints-that-are-too-low.patch percpu-search-the-whole-reserved-chunk.patch mm-filemap-convert-fault-and-readahead-logic-to-use-vma_flags_t.patch mm-madvise-convert-madvise_vma_behavior-to-use-vma_flags_t.patch mm-convert-miscellaneous-vma-flag-tests-to-use-vma_flags_t.patch fs-proc-task_mmu-convert-vma-flag-tests-to-use-vma_flags_t.patch fs-coredump-convert-vma_dump_size-to-use-vma_flags_t.patch uprobes-convert-vma-flag-tests-to-use-vma_flags_t.patch perf-convert-vma-flag-tests-to-use-vma_flags_t.patch selinux-convert-vma-flag-tests-to-use-vma_flags_t.patch apparmor-convert-vma-flag-tests-to-use-vma_flags_t.patch ima-convert-vma-flag-tests-to-use-vma_flags_t.patch ipe-convert-vma-flag-tests-to-use-vma_flags_t.patch
Lorenzo Stoakes (ARM)
maintainerPATCH v2 3/11 mm: convert miscellaneous VMA flag tests to use vma_flags_t
In reply to Lorenzo Stoakes (ARM)Replace use of the legacy vm_flags_t flags with vma_flags_t values in the remaining straightforward VMA flag tests scattered throughout core mm, HMM (and its test module), DAMON and the OOM reaper.
No functional change intended.
--- include/linux/mm_inline.h | 2 +- lib/test_hmm.c | 4 ++-- mm/damon/vaddr.c | 2 +- mm/hmm.c | 6 +++--- mm/internal.h | 2 +- mm/mempolicy.c | 4 ++-- mm/mmap_lock.c | 4 ++-- mm/msync.c | 4 ++-- mm/oom_kill.c | 4 ++-- mm/pagewalk.c | 2 +- mm/vma.h | 4 ++-- 11 files changed, 19 insertions(+), 19 deletions(-)
include/linux/mm_inline.h +1 -1
@@ -813,7 +813,7 @@ static inline pte_marker copy_pte_marker(static inline bool vma_has_recency (const struct vm_area_struct *vma) { -if (vma->vm_flags & (VM_SEQ_READ |VM_RAND_READ )) +if (vma_test_any (vma,VMA_SEQ_READ_BIT ,VMA_RAND_READ_BIT ))return false;if (vma->vm_file && (vma->vm_file->f_mode &FMODE_NOREUSE ))
lib/test_hmm.c +2 -2
@@ -1251,7 +1251,7 @@ static int dmirror_migrate_to_system(struct dmirror *dmirror,mmap_read_lock (mm);for (addr = start; addr < end; addr = next) { vma =vma_lookup (mm, addr); -if (!vma || !(vma->vm_flags &VM_READ )) { +if (!vma || !vma_test (vma,VMA_READ_BIT )) { ret = -EINVAL ; goto out; }
@@ -1323,7 +1323,7 @@ static int dmirror_migrate_to_device(struct dmirror *dmirror,mmap_read_lock (mm);for (addr = start; addr < end; addr = next) { vma =vma_lookup (mm, addr); -if (!vma || !(vma->vm_flags &VM_READ )) { +if (!vma || !vma_test (vma,VMA_READ_BIT )) { ret = -EINVAL ; goto out; }
mm/damon/vaddr.c +1 -1
@@ -240,7 +240,7 @@ static void damon_va_walk_page_range(struct mm_struct *mm, unsigned long start, goto lock_mmap; } -if (!(vma->vm_flags &VM_PFNMAP )) { +if (!vma_test (vma,VMA_PFNMAP_BIT )) { ops->walk_lock =PGWALK_VMA_RDLOCK_VERIFY ;walk_page_range_vma (vma, start, end, ops, private); }
mm/hmm.c +3 -3
@@ -596,9 +596,9 @@ static int hmm_vma_walk_test(unsigned long start, unsigned long end,struct hmm_range *range = hmm_vma_walk->range;struct vm_area_struct *vma = walk->vma; -if (!(vma->vm_flags & (VM_IO |VM_PFNMAP )) && +if (!vma_test_any (vma,VMA_IO_BIT ,VMA_PFNMAP_BIT ) && !vma_test_single_mask (vma,VMA_SHADOW_STACK ) && - vma->vm_flags &VM_READ ) +vma_test (vma,VMA_READ_BIT ))return 0 ;/*
@@ -663,7 +663,7 @@ static int hmm_do_fault(struct mm_struct *mm,return -EFAULT ;if (required_fault &HMM_NEED_WRITE_FAULT ) { -if (!(vma->vm_flags &VM_WRITE )) +if (!vma_test (vma,VMA_WRITE_BIT ))return -EPERM ; fault_flags |=FAULT_FLAG_WRITE ; }
mm/internal.h +1 -1
@@ -1259,7 +1259,7 @@ ssize_t splice_folio_into_pipe(struct pipe_inode_info *pipe,static inline bool vma_is_single_threaded_private (struct vm_area_struct *vma) { -if (vma->vm_flags &VM_SHARED ) +if (vma_test (vma,VMA_SHARED_BIT ))return false;return atomic_read (&vma->vm_mm->mm_users) ==1 ;
mm/mempolicy.c +2 -2
@@ -2015,7 +2015,7 @@ SYSCALL_DEFINE5(get_mempolicy, int __user *, policy,bool vma_migratable (struct vm_area_struct *vma) { -if (vma->vm_flags & (VM_IO |VM_PFNMAP )) +if (vma_test_any (vma,VMA_IO_BIT ,VMA_PFNMAP_BIT ))return false;/*
@@ -2567,7 +2567,7 @@ struct folio *vma_alloc_folio_noprof(gfp_t gfp, int order, struct vm_area_structpgoff_t ilx;struct folio *folio; -if (vma->vm_flags &VM_DROPPABLE ) +if (vma_test_single_mask (vma,VMA_DROPPABLE )) gfp |= __GFP_NOWARN; pol =get_vma_policy (vma, addr, order, &ilx);
mm/mmap_lock.c +2 -2
@@ -636,7 +636,7 @@ struct vm_area_struct *lock_mm_and_find_vma(struct mm_struct *mm,* Well, dang. We might still be successful, but only * if we can extend a vma to do so. */ -if (!vma || !(vma->vm_flags &VM_GROWSDOWN )) { +if (!vma || !vma_test (vma,VMA_GROWSDOWN_BIT )) {mmap_read_unlock (mm);return NULL ; }
@@ -659,7 +659,7 @@ struct vm_area_struct *lock_mm_and_find_vma(struct mm_struct *mm, goto fail;if (vma->vm_start <= addr) goto success; -if (!(vma->vm_flags &VM_GROWSDOWN )) +if (!vma_test (vma,VMA_GROWSDOWN_BIT )) goto fail; }
mm/msync.c +2 -2
@@ -79,7 +79,7 @@ SYSCALL_DEFINE3(msync, unsigned long, start, size_t, len, int, flags) }/* Here vma->vm_start <= start < vma->vm_end. */ if ((flags &MS_INVALIDATE ) && - (vma->vm_flags &VM_LOCKED )) { +vma_test (vma,VMA_LOCKED_BIT )) { error = -EBUSY ; goto out_unlock; }
@@ -88,7 +88,7 @@ SYSCALL_DEFINE3(msync, unsigned long, start, size_t, len, int, flags) fend = fstart + (min (end, vma->vm_end) - start) -1 ; start = vma->vm_end;if ((flags &MS_SYNC ) && file && - (vma->vm_flags &VM_SHARED )) { +vma_test (vma,VMA_SHARED_BIT )) {get_file (file);mmap_read_unlock (mm); error =vfs_fsync_range (file, fstart, fend,1 );
mm/oom_kill.c +2 -2
@@ -524,7 +524,7 @@ static bool __oom_reap_task_mm(struct mm_struct *mm)* of the address space. */ mas_for_each_rev (&mas, vma,0 ) { -if (vma->vm_flags & (VM_HUGETLB |VM_PFNMAP )) +if (vma_test_any (vma,VMA_HUGETLB_BIT ,VMA_PFNMAP_BIT ))continue ;/*
@@ -537,7 +537,7 @@ static bool __oom_reap_task_mm(struct mm_struct *mm)* we do not want to block exit_mmap by keeping mm ref * count elevated without a good reason. */ -if (vma_is_anonymous (vma) || !(vma->vm_flags &VM_SHARED )) { +if (vma_is_anonymous (vma) || !vma_test (vma,VMA_SHARED_BIT )) {if (zap_vma_for_reaping (vma)) ret = false; }
mm/pagewalk.c +1 -1
@@ -393,7 +393,7 @@ static int walk_page_test(unsigned long start, unsigned long end,* define their ->pte_hole() callbacks, so let's delegate them to handle * vma(VM_PFNMAP). */ -if (vma->vm_flags &VM_PFNMAP ) { +if (vma_test (vma,VMA_PFNMAP_BIT )) {int err =1 ;if (ops->pte_hole) err = ops->pte_hole (start, end,-1 , walk);
mm/vma.h +2 -2
@@ -596,9 +596,9 @@ static inline bool vma_wants_manual_pte_write_upgrade(struct vm_area_struct *vma* private mappings, that's always the case when we have write * permissions as we properly have to handle COW. */ -if (vma->vm_flags &VM_SHARED ) +if (vma_test (vma,VMA_SHARED_BIT ))return vma_wants_writenotify (vma, vma->vm_page_prot); -return !!(vma->vm_flags &VM_WRITE ); +return vma_test (vma,VMA_WRITE_BIT ); }#ifdef CONFIG_MMU
Signature · 1 line
2.56.1
+ mm-convert-miscellaneous-vma-flag-tests-to-use-vma_flags_t.patch added to mm-new branch
The patch titled Subject: mm: convert miscellaneous VMA flag tests to use vma_flags_t has been added to the -mm mm-new branch. Its filename is…
The patch titled
Subject: mm: convert miscellaneous VMA flag tests to use vma_flags_t
has been added to the -mm mm-new branch. Its filename is
mm-convert-miscellaneous-vma-flag-tests-to-use-vma_flags_t.patch
This patch will shortly appear at
https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-convert-miscellaneous-vma-flag-tests-to-use-vma_flags_t.patch
This patch will later appear in the mm-new branch at
git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Note, mm-new is a provisional staging ground for work-in-progress patches, and acceptance into mm-new is a notification for others take notice and to finish up reviews. Please do not hesitate to respond to review feedback and post updated versions to replace or incrementally fixup patches in mm-new.
The mm-new branch of mm.git is not included in linux-next
If a few days of testing in mm-new is successful, the patch will me moved into mm.git's mm-unstable branch, which is included in linux-next
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next via various branches at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there most days
------------------------------------------------------
From: "Lorenzo Stoakes (ARM)" <[email protected]>
Subject: mm: convert miscellaneous VMA flag tests to use vma_flags_t
Date: Tue, 24 Nov 2026 17:07:55 +0000
Replace use of the legacy vm_flags_t flags with vma_flags_t values in the remaining straightforward VMA flag tests scattered throughout core mm, HMM (and its test module), DAMON and the OOM reaper.
No functional change intended.
include/linux/mm_inline.h | 2 +- lib/test_hmm.c | 4 ++-- mm/damon/vaddr.c | 2 +- mm/hmm.c | 6 +++--- mm/internal.h | 2 +- mm/mempolicy.c | 4 ++-- mm/mmap_lock.c | 4 ++-- mm/msync.c | 4 ++-- mm/oom_kill.c | 4 ++-- mm/pagewalk.c | 2 +- mm/vma.h | 4 ++-- 11 files changed, 19 insertions(+), 19 deletions(-)
include/linux/mm_inline.h renamed from include/linux/mm_inline.h~mm-convert-miscellaneous-vma-flag-tests-to-use-vma_flags_t +1 -1
@@ -813,7 +813,7 @@ static inline pte_marker copy_pte_markerstatic inline bool vma_has_recency (const struct vm_area_struct *vma) { -if (vma->vm_flags & (VM_SEQ_READ |VM_RAND_READ )) +if (vma_test_any (vma,VMA_SEQ_READ_BIT ,VMA_RAND_READ_BIT ))return false;if (vma->vm_file && (vma->vm_file->f_mode &FMODE_NOREUSE ))
lib/test_hmm.c renamed from lib/test_hmm.c~mm-convert-miscellaneous-vma-flag-tests-to-use-vma_flags_t +2 -2
@@ -1251,7 +1251,7 @@ static int dmirror_migrate_to_system(strmmap_read_lock (mm);for (addr = start; addr < end; addr = next) { vma =vma_lookup (mm, addr); -if (!vma || !(vma->vm_flags &VM_READ )) { +if (!vma || !vma_test (vma,VMA_READ_BIT )) { ret = -EINVAL ; goto out; }
@@ -1323,7 +1323,7 @@ static int dmirror_migrate_to_device(strmmap_read_lock (mm);for (addr = start; addr < end; addr = next) { vma =vma_lookup (mm, addr); -if (!vma || !(vma->vm_flags &VM_READ )) { +if (!vma || !vma_test (vma,VMA_READ_BIT )) { ret = -EINVAL ; goto out; }
mm/damon/vaddr.c renamed from mm/damon/vaddr.c~mm-convert-miscellaneous-vma-flag-tests-to-use-vma_flags_t +1 -1
@@ -240,7 +240,7 @@ static void damon_va_walk_page_range(str goto lock_mmap; } -if (!(vma->vm_flags &VM_PFNMAP )) { +if (!vma_test (vma,VMA_PFNMAP_BIT )) { ops->walk_lock =PGWALK_VMA_RDLOCK_VERIFY ;walk_page_range_vma (vma, start, end, ops, private); }
mm/hmm.c renamed from mm/hmm.c~mm-convert-miscellaneous-vma-flag-tests-to-use-vma_flags_t +3 -3
@@ -596,9 +596,9 @@ static int hmm_vma_walk_test(unsigned lostruct hmm_range *range = hmm_vma_walk->range;struct vm_area_struct *vma = walk->vma; -if (!(vma->vm_flags & (VM_IO |VM_PFNMAP )) && +if (!vma_test_any (vma,VMA_IO_BIT ,VMA_PFNMAP_BIT ) && !vma_test_single_mask (vma,VMA_SHADOW_STACK ) && - vma->vm_flags &VM_READ ) +vma_test (vma,VMA_READ_BIT ))return 0 ;/*
@@ -663,7 +663,7 @@ static int hmm_do_fault(struct mm_structreturn -EFAULT ;if (required_fault &HMM_NEED_WRITE_FAULT ) { -if (!(vma->vm_flags &VM_WRITE )) +if (!vma_test (vma,VMA_WRITE_BIT ))return -EPERM ; fault_flags |=FAULT_FLAG_WRITE ; }
mm/internal.h renamed from mm/internal.h~mm-convert-miscellaneous-vma-flag-tests-to-use-vma_flags_t +1 -1
@@ -1259,7 +1259,7 @@ ssize_t splice_folio_into_pipe(struct pistatic inline bool vma_is_single_threaded_private (struct vm_area_struct *vma) { -if (vma->vm_flags &VM_SHARED ) +if (vma_test (vma,VMA_SHARED_BIT ))return false;return atomic_read (&vma->vm_mm->mm_users) ==1 ;
mm/mempolicy.c renamed from mm/mempolicy.c~mm-convert-miscellaneous-vma-flag-tests-to-use-vma_flags_t +2 -2
@@ -2015,7 +2015,7 @@ SYSCALL_DEFINE5(get_mempolicy, int __usebool vma_migratable (struct vm_area_struct *vma) { -if (vma->vm_flags & (VM_IO |VM_PFNMAP )) +if (vma_test_any (vma,VMA_IO_BIT ,VMA_PFNMAP_BIT ))return false;/*
@@ -2567,7 +2567,7 @@ struct folio *vma_alloc_folio_noprof(gfppgoff_t ilx;struct folio *folio; -if (vma->vm_flags &VM_DROPPABLE ) +if (vma_test_single_mask (vma,VMA_DROPPABLE )) gfp |= __GFP_NOWARN; pol =get_vma_policy (vma, addr, order, &ilx);
mm/mmap_lock.c renamed from mm/mmap_lock.c~mm-convert-miscellaneous-vma-flag-tests-to-use-vma_flags_t +2 -2
@@ -651,7 +651,7 @@ struct vm_area_struct *lock_mm_and_find_* Well, dang. We might still be successful, but only * if we can extend a vma to do so. */ -if (!vma || !(vma->vm_flags &VM_GROWSDOWN )) { +if (!vma || !vma_test (vma,VMA_GROWSDOWN_BIT )) {mmap_read_unlock (mm);return NULL ; }
@@ -674,7 +674,7 @@ struct vm_area_struct *lock_mm_and_find_ goto fail;if (vma->vm_start <= addr) goto success; -if (!(vma->vm_flags &VM_GROWSDOWN )) +if (!vma_test (vma,VMA_GROWSDOWN_BIT )) goto fail; }
mm/msync.c renamed from mm/msync.c~mm-convert-miscellaneous-vma-flag-tests-to-use-vma_flags_t +2 -2
@@ -79,7 +79,7 @@ SYSCALL_DEFINE3(msync, unsigned long, st }/* Here vma->vm_start <= start < vma->vm_end. */ if ((flags &MS_INVALIDATE ) && - (vma->vm_flags &VM_LOCKED )) { +vma_test (vma,VMA_LOCKED_BIT )) { error = -EBUSY ; goto out_unlock; }
@@ -88,7 +88,7 @@ SYSCALL_DEFINE3(msync, unsigned long, st fend = fstart + (min (end, vma->vm_end) - start) -1 ; start = vma->vm_end;if ((flags &MS_SYNC ) && file && - (vma->vm_flags &VM_SHARED )) { +vma_test (vma,VMA_SHARED_BIT )) {get_file (file);mmap_read_unlock (mm); error =vfs_fsync_range (file, fstart, fend,1 );
mm/oom_kill.c renamed from mm/oom_kill.c~mm-convert-miscellaneous-vma-flag-tests-to-use-vma_flags_t +2 -2
@@ -524,7 +524,7 @@ static bool __oom_reap_task_mm(struct mm* of the address space. */ mas_for_each_rev (&mas, vma,0 ) { -if (vma->vm_flags & (VM_HUGETLB |VM_PFNMAP )) +if (vma_test_any (vma,VMA_HUGETLB_BIT ,VMA_PFNMAP_BIT ))continue ;/*
@@ -537,7 +537,7 @@ static bool __oom_reap_task_mm(struct mm* we do not want to block exit_mmap by keeping mm ref * count elevated without a good reason. */ -if (vma_is_anonymous (vma) || !(vma->vm_flags &VM_SHARED )) { +if (vma_is_anonymous (vma) || !vma_test (vma,VMA_SHARED_BIT )) {if (zap_vma_for_reaping (vma)) ret = false; }
mm/pagewalk.c renamed from mm/pagewalk.c~mm-convert-miscellaneous-vma-flag-tests-to-use-vma_flags_t +1 -1
@@ -393,7 +393,7 @@ static int walk_page_test(unsigned long* define their ->pte_hole() callbacks, so let's delegate them to handle * vma(VM_PFNMAP). */ -if (vma->vm_flags &VM_PFNMAP ) { +if (vma_test (vma,VMA_PFNMAP_BIT )) {int err =1 ;if (ops->pte_hole) err = ops->pte_hole (start, end,-1 , walk);
mm/vma.h renamed from mm/vma.h~mm-convert-miscellaneous-vma-flag-tests-to-use-vma_flags_t +2 -2
@@ -596,9 +596,9 @@ static inline bool vma_wants_manual_pte_* private mappings, that's always the case when we have write * permissions as we properly have to handle COW. */ -if (vma->vm_flags &VM_SHARED ) +if (vma_test (vma,VMA_SHARED_BIT ))return vma_wants_writenotify (vma, vma->vm_page_prot); -return !!(vma->vm_flags &VM_WRITE ); +return vma_test (vma,VMA_WRITE_BIT ); }#ifdef CONFIG_MMU
_
Patches currently in -mm which might be from [email protected] are
mm-msync-return-enomem-if-page-aligned-length-overflows.patch mm-vma-drop-mm-asynchronously-in-vma_start_read.patch mm-vma-predicate-vma_assert_stabilised-on-config_debug_vm.patch mm-only-assert-mmap-locks-if-config_debug_vm-or-lockdep-is-set.patch mm-only-assert-vma-locks-if-config_debug_vm-is-set.patch mm-convert-warn_on_onces-to-vm_warn_on_once-in-vma-lock-code.patch mm-madvise-zap-markers-from-guard-regions.patch mm-mmap-free-gathered-pages-before-mmf_oom_skip.patch percpu-fix-contig-hints-that-are-too-low.patch percpu-search-the-whole-reserved-chunk.patch mm-filemap-convert-fault-and-readahead-logic-to-use-vma_flags_t.patch mm-madvise-convert-madvise_vma_behavior-to-use-vma_flags_t.patch mm-convert-miscellaneous-vma-flag-tests-to-use-vma_flags_t.patch fs-proc-task_mmu-convert-vma-flag-tests-to-use-vma_flags_t.patch fs-coredump-convert-vma_dump_size-to-use-vma_flags_t.patch uprobes-convert-vma-flag-tests-to-use-vma_flags_t.patch perf-convert-vma-flag-tests-to-use-vma_flags_t.patch selinux-convert-vma-flag-tests-to-use-vma_flags_t.patch apparmor-convert-vma-flag-tests-to-use-vma_flags_t.patch ima-convert-vma-flag-tests-to-use-vma_flags_t.patch ipe-convert-vma-flag-tests-to-use-vma_flags_t.patch
Lorenzo Stoakes (ARM)
maintainerPATCH v2 4/11 fs/proc/task_mmu: convert VMA flag tests to use vma_flags_t
In reply to Lorenzo Stoakes (ARM)Replace use of the legacy vm_flags_t flags with vma_flags_t values where VMA flags are tested directly in /proc/$pid/[s]maps, pagemap, clear_refs and PROCMAP_QUERY.
In replacing vm_flags_clear() (which takes the VMA write lock) with vma_clear_flags() (which does not) in clear_refs_write(), we explicitly write lock the VMA. The mmap write lock is already held at this point.
Note that vm_flags_clear() asserts that the page tables support soft-dirty when clearing VM_SOFTDIRTY, whereas vma_clear_flags() does not. No other VMA flag is checked this way, so this assert is intentionally dropped.
The show_vma_header_prefix() and show_smap_vma_flags() output functions and the thp_vma_allowable_orders() call continue to use legacy flags for the time being.
No functional change intended.
--- fs/proc/task_mmu.c | 43 ++++++++++++++++++++++--------------------- 1 file changed, 22 insertions(+), 21 deletions(-)
fs/proc/task_mmu.c +22 -21
@@ -570,18 +570,18 @@ static struct vm_area_struct *query_matching_vma(struct proc_maps_locking_ctx *l/* VMA permissions should satisfy query flags */ if (flags &PROCMAP_QUERY_VMA_FLAGS ) { -u32 perm =0 ; +vma_flags_t perm =EMPTY_VMA_FLAGS ;if (flags &PROCMAP_QUERY_VMA_READABLE ) - perm |=VM_READ ; +vma_flags_set (&perm,VMA_READ_BIT );if (flags &PROCMAP_QUERY_VMA_WRITABLE ) - perm |=VM_WRITE ; +vma_flags_set (&perm,VMA_WRITE_BIT );if (flags &PROCMAP_QUERY_VMA_EXECUTABLE ) - perm |=VM_EXEC ; +vma_flags_set (&perm,VMA_EXEC_BIT );if (flags &PROCMAP_QUERY_VMA_SHARED ) - perm |=VM_MAYSHARE ; +vma_flags_set (&perm,VMA_MAYSHARE_BIT ); -if ((vma->vm_flags & perm) != perm) +if (!vma_test_all_mask (vma, perm)) goto skip_vma; }
@@ -648,13 +648,13 @@ static int do_procmap_query(struct mm_struct *mm, void __user *uarg) karg.vma_end = vma->vm_end; karg.vma_flags =0 ; -if (vma->vm_flags &VM_READ ) +if (vma_test (vma,VMA_READ_BIT )) karg.vma_flags |=PROCMAP_QUERY_VMA_READABLE ; -if (vma->vm_flags &VM_WRITE ) +if (vma_test (vma,VMA_WRITE_BIT )) karg.vma_flags |=PROCMAP_QUERY_VMA_WRITABLE ; -if (vma->vm_flags &VM_EXEC ) +if (vma_test (vma,VMA_EXEC_BIT )) karg.vma_flags |=PROCMAP_QUERY_VMA_EXECUTABLE ; -if (vma->vm_flags &VM_MAYSHARE ) +if (vma_test (vma,VMA_MAYSHARE_BIT )) karg.vma_flags |=PROCMAP_QUERY_VMA_SHARED ; karg.vma_page_size =vma_kernel_pagesize (vma);
@@ -971,7 +971,7 @@ static void smaps_pte_entry(pte_t *pte, unsigned long addr, {struct mem_size_stats *mss = walk->private;struct vm_area_struct *vma = walk->vma; -bool locked = !!(vma->vm_flags &VM_LOCKED ); +bool locked =vma_test (vma,VMA_LOCKED_BIT );struct page *page =NULL ;bool present = false, young = false, dirty = false;pte_t ptent =ptep_get (pte);
@@ -1018,7 +1018,7 @@ static void smaps_pmd_entry(pmd_t *pmd, unsigned long addr, {struct mem_size_stats *mss = walk->private;struct vm_area_struct *vma = walk->vma; -bool locked = !!(vma->vm_flags &VM_LOCKED ); +bool locked =vma_test (vma,VMA_LOCKED_BIT );struct page *page =NULL ;bool present = false;struct folio *folio;
@@ -1732,7 +1732,7 @@ static int clear_refs_test_walk(unsigned long start, unsigned long end,struct clear_refs_private *cp = walk->private;struct vm_area_struct *vma = walk->vma; -if (vma->vm_flags &VM_PFNMAP ) +if (vma_test (vma,VMA_PFNMAP_BIT ))return 1 ;/*
@@ -1802,9 +1802,10 @@ static ssize_t clear_refs_write(struct file *file, const char __user *buf,if (type ==CLEAR_REFS_SOFT_DIRTY ) {for_each_vma (vmi, vma) { -if (!(vma->vm_flags &VM_SOFTDIRTY )) +if (!vma_test (vma,VMA_SOFTDIRTY_BIT ))continue ; -vm_flags_clear (vma,VM_SOFTDIRTY ); +vma_start_write (vma); +vma_clear_flags (vma,VMA_SOFTDIRTY_BIT );vma_set_page_prot (vma); }
@@ -1908,7 +1909,7 @@ static int pagemap_pte_hole(unsigned long start, unsigned long end,break ;/* Addresses in the VMA. */ -if (vma->vm_flags &VM_SOFTDIRTY ) +if (vma_test (vma,VMA_SOFTDIRTY_BIT )) pme =make_pme (0 ,PM_SOFT_DIRTY );for (; addr <min (end, vma->vm_end); addr +=PAGE_SIZE ) { err =add_to_pagemap (&pme, pm);
@@ -1980,7 +1981,7 @@ static pagemap_entry_t pte_to_pagemap_entry(struct pagemapread *pm, } out: -if (vma->vm_flags &VM_SOFTDIRTY ) +if (vma_test (vma,VMA_SOFTDIRTY_BIT )) flags |=PM_SOFT_DIRTY ;return make_pme (frame, flags);
@@ -1998,7 +1999,7 @@ static int pagemap_pmd_range_thp(pmd_t *pmdp, unsigned long addr,struct folio *folio =NULL ;int err =0 ; -if (vma->vm_flags &VM_SOFTDIRTY ) +if (vma_test (vma,VMA_SOFTDIRTY_BIT )) flags |=PM_SOFT_DIRTY ;if (pmd_none (pmd))
@@ -2120,7 +2121,7 @@ static int pagemap_hugetlb_range(pte_t *ptep, unsigned long hmask,int err =0 ;pte_t pte; -if (vma->vm_flags &VM_SOFTDIRTY ) +if (vma_test (vma,VMA_SOFTDIRTY_BIT )) flags |=PM_SOFT_DIRTY ; ptl =huge_pte_lock (hstate_vma (vma), walk->mm, ptep);
@@ -2629,13 +2630,13 @@ static int pagemap_scan_test_walk(unsigned long start, unsigned long end,*/ } -if (vma->vm_flags &VM_PFNMAP ) +if (vma_test (vma,VMA_PFNMAP_BIT ))return 1 ;if (wp_allowed) vma_category |=PAGE_IS_WPALLOWED ; -if (vma->vm_flags &VM_SOFTDIRTY ) +if (vma_test (vma,VMA_SOFTDIRTY_BIT )) vma_category |=PAGE_IS_SOFT_DIRTY ;if (!pagemap_scan_is_interesting_vma (vma_category, p))
Signature · 1 line
2.56.1
+ fs-proc-task_mmu-convert-vma-flag-tests-to-use-vma_flags_t.patch added to mm-new branch
The patch titled Subject: fs/proc/task_mmu: convert VMA flag tests to use vma_flags_t has been added to the -mm mm-new branch. Its filename is…
The patch titled
Subject: fs/proc/task_mmu: convert VMA flag tests to use vma_flags_t
has been added to the -mm mm-new branch. Its filename is
fs-proc-task_mmu-convert-vma-flag-tests-to-use-vma_flags_t.patch
This patch will shortly appear at
https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/fs-proc-task_mmu-convert-vma-flag-tests-to-use-vma_flags_t.patch
This patch will later appear in the mm-new branch at
git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Note, mm-new is a provisional staging ground for work-in-progress patches, and acceptance into mm-new is a notification for others take notice and to finish up reviews. Please do not hesitate to respond to review feedback and post updated versions to replace or incrementally fixup patches in mm-new.
The mm-new branch of mm.git is not included in linux-next
If a few days of testing in mm-new is successful, the patch will me moved into mm.git's mm-unstable branch, which is included in linux-next
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next via various branches at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there most days
------------------------------------------------------
From: "Lorenzo Stoakes (ARM)" <[email protected]>
Subject: fs/proc/task_mmu: convert VMA flag tests to use vma_flags_t
Date: Tue, 24 Nov 2026 17:07:56 +0000
Replace use of the legacy vm_flags_t flags with vma_flags_t values where VMA flags are tested directly in /proc/$pid/[s]maps, pagemap, clear_refs and PROCMAP_QUERY.
In replacing vm_flags_clear() (which takes the VMA write lock) with vma_clear_flags() (which does not) in clear_refs_write(), we explicitly write lock the VMA. The mmap write lock is already held at this point.
Note that vm_flags_clear() asserts that the page tables support soft-dirty when clearing VM_SOFTDIRTY, whereas vma_clear_flags() does not. No other VMA flag is checked this way, so this assert is intentionally dropped.
The show_vma_header_prefix() and show_smap_vma_flags() output functions and the thp_vma_allowable_orders() call continue to use legacy flags for the time being.
No functional change intended.
fs/proc/task_mmu.c | 43 ++++++++++++++++++++++--------------------- 1 file changed, 22 insertions(+), 21 deletions(-)
fs/proc/task_mmu.c renamed from fs/proc/task_mmu.c~fs-proc-task_mmu-convert-vma-flag-tests-to-use-vma_flags_t +22 -21
@@ -570,18 +570,18 @@ next_vma:/* VMA permissions should satisfy query flags */ if (flags &PROCMAP_QUERY_VMA_FLAGS ) { -u32 perm =0 ; +vma_flags_t perm =EMPTY_VMA_FLAGS ;if (flags &PROCMAP_QUERY_VMA_READABLE ) - perm |=VM_READ ; +vma_flags_set (&perm,VMA_READ_BIT );if (flags &PROCMAP_QUERY_VMA_WRITABLE ) - perm |=VM_WRITE ; +vma_flags_set (&perm,VMA_WRITE_BIT );if (flags &PROCMAP_QUERY_VMA_EXECUTABLE ) - perm |=VM_EXEC ; +vma_flags_set (&perm,VMA_EXEC_BIT );if (flags &PROCMAP_QUERY_VMA_SHARED ) - perm |=VM_MAYSHARE ; +vma_flags_set (&perm,VMA_MAYSHARE_BIT ); -if ((vma->vm_flags & perm) != perm) +if (!vma_test_all_mask (vma, perm)) goto skip_vma; }
@@ -648,13 +648,13 @@ static int do_procmap_query(struct mm_st karg.vma_end = vma->vm_end; karg.vma_flags =0 ; -if (vma->vm_flags &VM_READ ) +if (vma_test (vma,VMA_READ_BIT )) karg.vma_flags |=PROCMAP_QUERY_VMA_READABLE ; -if (vma->vm_flags &VM_WRITE ) +if (vma_test (vma,VMA_WRITE_BIT )) karg.vma_flags |=PROCMAP_QUERY_VMA_WRITABLE ; -if (vma->vm_flags &VM_EXEC ) +if (vma_test (vma,VMA_EXEC_BIT )) karg.vma_flags |=PROCMAP_QUERY_VMA_EXECUTABLE ; -if (vma->vm_flags &VM_MAYSHARE ) +if (vma_test (vma,VMA_MAYSHARE_BIT )) karg.vma_flags |=PROCMAP_QUERY_VMA_SHARED ; karg.vma_page_size =vma_kernel_pagesize (vma);
@@ -971,7 +971,7 @@ static void smaps_pte_entry(pte_t *pte, {struct mem_size_stats *mss = walk->private;struct vm_area_struct *vma = walk->vma; -bool locked = !!(vma->vm_flags &VM_LOCKED ); +bool locked =vma_test (vma,VMA_LOCKED_BIT );struct page *page =NULL ;bool present = false, young = false, dirty = false;pte_t ptent =ptep_get (pte);
@@ -1018,7 +1018,7 @@ static void smaps_pmd_entry(pmd_t *pmd, {struct mem_size_stats *mss = walk->private;struct vm_area_struct *vma = walk->vma; -bool locked = !!(vma->vm_flags &VM_LOCKED ); +bool locked =vma_test (vma,VMA_LOCKED_BIT );struct page *page =NULL ;bool present = false;struct folio *folio;
@@ -1732,7 +1732,7 @@ static int clear_refs_test_walk(unsignedstruct clear_refs_private *cp = walk->private;struct vm_area_struct *vma = walk->vma; -if (vma->vm_flags &VM_PFNMAP ) +if (vma_test (vma,VMA_PFNMAP_BIT ))return 1 ;/*
@@ -1802,9 +1802,10 @@ static ssize_t clear_refs_write(struct fif (type ==CLEAR_REFS_SOFT_DIRTY ) {for_each_vma (vmi, vma) { -if (!(vma->vm_flags &VM_SOFTDIRTY )) +if (!vma_test (vma,VMA_SOFTDIRTY_BIT ))continue ; -vm_flags_clear (vma,VM_SOFTDIRTY ); +vma_start_write (vma); +vma_clear_flags (vma,VMA_SOFTDIRTY_BIT );vma_set_page_prot (vma); }
@@ -1908,7 +1909,7 @@ static int pagemap_pte_hole(unsigned lonbreak ;/* Addresses in the VMA. */ -if (vma->vm_flags &VM_SOFTDIRTY ) +if (vma_test (vma,VMA_SOFTDIRTY_BIT )) pme =make_pme (0 ,PM_SOFT_DIRTY );for (; addr <min (end, vma->vm_end); addr +=PAGE_SIZE ) { err =add_to_pagemap (&pme, pm);
@@ -1980,7 +1981,7 @@ static pagemap_entry_t pte_to_pagemap_en } out: -if (vma->vm_flags &VM_SOFTDIRTY ) +if (vma_test (vma,VMA_SOFTDIRTY_BIT )) flags |=PM_SOFT_DIRTY ;return make_pme (frame, flags);
@@ -1998,7 +1999,7 @@ static int pagemap_pmd_range_thp(pmd_t *struct folio *folio =NULL ;int err =0 ; -if (vma->vm_flags &VM_SOFTDIRTY ) +if (vma_test (vma,VMA_SOFTDIRTY_BIT )) flags |=PM_SOFT_DIRTY ;if (pmd_none (pmd))
@@ -2120,7 +2121,7 @@ static int pagemap_hugetlb_range(pte_t *int err =0 ;pte_t pte; -if (vma->vm_flags &VM_SOFTDIRTY ) +if (vma_test (vma,VMA_SOFTDIRTY_BIT )) flags |=PM_SOFT_DIRTY ; ptl =huge_pte_lock (hstate_vma (vma), walk->mm, ptep);
@@ -2629,13 +2630,13 @@ static int pagemap_scan_test_walk(unsign*/ } -if (vma->vm_flags &VM_PFNMAP ) +if (vma_test (vma,VMA_PFNMAP_BIT ))return 1 ;if (wp_allowed) vma_category |=PAGE_IS_WPALLOWED ; -if (vma->vm_flags &VM_SOFTDIRTY ) +if (vma_test (vma,VMA_SOFTDIRTY_BIT )) vma_category |=PAGE_IS_SOFT_DIRTY ;if (!pagemap_scan_is_interesting_vma (vma_category, p))
_
Patches currently in -mm which might be from [email protected] are
mm-msync-return-enomem-if-page-aligned-length-overflows.patch mm-vma-drop-mm-asynchronously-in-vma_start_read.patch mm-vma-predicate-vma_assert_stabilised-on-config_debug_vm.patch mm-only-assert-mmap-locks-if-config_debug_vm-or-lockdep-is-set.patch mm-only-assert-vma-locks-if-config_debug_vm-is-set.patch mm-convert-warn_on_onces-to-vm_warn_on_once-in-vma-lock-code.patch mm-madvise-zap-markers-from-guard-regions.patch mm-mmap-free-gathered-pages-before-mmf_oom_skip.patch percpu-fix-contig-hints-that-are-too-low.patch percpu-search-the-whole-reserved-chunk.patch mm-filemap-convert-fault-and-readahead-logic-to-use-vma_flags_t.patch mm-madvise-convert-madvise_vma_behavior-to-use-vma_flags_t.patch mm-convert-miscellaneous-vma-flag-tests-to-use-vma_flags_t.patch fs-proc-task_mmu-convert-vma-flag-tests-to-use-vma_flags_t.patch fs-coredump-convert-vma_dump_size-to-use-vma_flags_t.patch uprobes-convert-vma-flag-tests-to-use-vma_flags_t.patch perf-convert-vma-flag-tests-to-use-vma_flags_t.patch selinux-convert-vma-flag-tests-to-use-vma_flags_t.patch apparmor-convert-vma-flag-tests-to-use-vma_flags_t.patch ima-convert-vma-flag-tests-to-use-vma_flags_t.patch ipe-convert-vma-flag-tests-to-use-vma_flags_t.patch
Lorenzo Stoakes (ARM)
maintainerPATCH v2 5/11 fs/coredump: convert vma_dump_size() to use vma_flags_t
In reply to Lorenzo Stoakes (ARM)Replace use of the legacy vm_flags_t flags with vma_flags_t values when determining how much of a VMA to dump.
The flags copied into struct core_vma_metadata remain legacy flags as they are consumed by the binfmt handlers.
No functional change intended.
--- fs/coredump.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
fs/coredump.c +8 -8
@@ -1837,15 +1837,15 @@ static unsigned long vma_dump_size(struct vm_area_struct *vma,if (always_dump_vma (vma)) goto whole; -if (vma->vm_flags &VM_DONTDUMP ) +if (vma_test (vma,VMA_DONTDUMP_BIT ))return 0 ;/* support for DAX */ if (vma_is_dax (vma)) { -if ((vma->vm_flags &VM_SHARED ) && +if (vma_test (vma,VMA_SHARED_BIT ) &&COREDUMP_MEMORY_TYPE_INCLUDE (memory_types,DAX_SHARED )) goto whole; -if (!(vma->vm_flags &VM_SHARED ) && +if (!vma_test (vma,VMA_SHARED_BIT ) &&COREDUMP_MEMORY_TYPE_INCLUDE (memory_types,DAX_PRIVATE )) goto whole;return 0 ;
@@ -1853,21 +1853,21 @@ static unsigned long vma_dump_size(struct vm_area_struct *vma,/* Hugetlb memory check */ if (vma_is_hugetlb (vma)) { -if ((vma->vm_flags &VM_SHARED ) && +if (vma_test (vma,VMA_SHARED_BIT ) &&COREDUMP_MEMORY_TYPE_INCLUDE (memory_types,HUGETLB_SHARED )) goto whole; -if (!(vma->vm_flags &VM_SHARED ) && +if (!vma_test (vma,VMA_SHARED_BIT ) &&COREDUMP_MEMORY_TYPE_INCLUDE (memory_types,HUGETLB_PRIVATE )) goto whole;return 0 ; }/* Do not dump I/O mapped devices or special mappings */ -if (vma->vm_flags &VM_IO ) +if (vma_test (vma,VMA_IO_BIT ))return 0 ;/* By default, dump shared memory if mapped from an anonymous file. */ -if (vma->vm_flags &VM_SHARED ) { +if (vma_test (vma,VMA_SHARED_BIT )) {if (file_inode (vma->vm_file)->i_nlink ==0 ?COREDUMP_MEMORY_TYPE_INCLUDE (memory_types,ANON_SHARED ) :COREDUMP_MEMORY_TYPE_INCLUDE (memory_types,FILE_SHARED ))
@@ -1890,7 +1890,7 @@ static unsigned long vma_dump_size(struct vm_area_struct *vma,* dump the first page to aid in determining what was mapped here. */ if (COREDUMP_MEMORY_TYPE_INCLUDE (memory_types,ELF_HEADERS ) && - vma->vm_pgoff ==0 && (vma->vm_flags &VM_READ )) { + vma->vm_pgoff ==0 &&vma_test (vma,VMA_READ_BIT )) {if ((READ_ONCE (file_inode (vma->vm_file)->i_mode) &0111 ) !=0 )return PAGE_SIZE ;
Signature · 1 line
2.56.1
+ fs-coredump-convert-vma_dump_size-to-use-vma_flags_t.patch added to mm-new branch
The patch titled Subject: fs/coredump: convert vma_dump_size() to use vma_flags_t has been added to the -mm mm-new branch. Its filename is fs-coredump-convert-vma_dump_size-to-use-vma_flags_t.patch
The patch titled
Subject: fs/coredump: convert vma_dump_size() to use vma_flags_t
has been added to the -mm mm-new branch. Its filename is
fs-coredump-convert-vma_dump_size-to-use-vma_flags_t.patch
This patch will shortly appear at
https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/fs-coredump-convert-vma_dump_size-to-use-vma_flags_t.patch
This patch will later appear in the mm-new branch at
git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Note, mm-new is a provisional staging ground for work-in-progress patches, and acceptance into mm-new is a notification for others take notice and to finish up reviews. Please do not hesitate to respond to review feedback and post updated versions to replace or incrementally fixup patches in mm-new.
The mm-new branch of mm.git is not included in linux-next
If a few days of testing in mm-new is successful, the patch will me moved into mm.git's mm-unstable branch, which is included in linux-next
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next via various branches at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there most days
------------------------------------------------------
From: "Lorenzo Stoakes (ARM)" <[email protected]>
Subject: fs/coredump: convert vma_dump_size() to use vma_flags_t
Date: Tue, 24 Nov 2026 17:07:57 +0000
Replace use of the legacy vm_flags_t flags with vma_flags_t values when determining how much of a VMA to dump.
The flags copied into struct core_vma_metadata remain legacy flags as they are consumed by the binfmt handlers.
No functional change intended.
fs/coredump.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
fs/coredump.c renamed from fs/coredump.c~fs-coredump-convert-vma_dump_size-to-use-vma_flags_t +8 -8
@@ -1837,15 +1837,15 @@ static unsigned long vma_dump_size(strucif (always_dump_vma (vma)) goto whole; -if (vma->vm_flags &VM_DONTDUMP ) +if (vma_test (vma,VMA_DONTDUMP_BIT ))return 0 ;/* support for DAX */ if (vma_is_dax (vma)) { -if ((vma->vm_flags &VM_SHARED ) && +if (vma_test (vma,VMA_SHARED_BIT ) &&COREDUMP_MEMORY_TYPE_INCLUDE (memory_types,DAX_SHARED )) goto whole; -if (!(vma->vm_flags &VM_SHARED ) && +if (!vma_test (vma,VMA_SHARED_BIT ) &&COREDUMP_MEMORY_TYPE_INCLUDE (memory_types,DAX_PRIVATE )) goto whole;return 0 ;
@@ -1853,21 +1853,21 @@ static unsigned long vma_dump_size(struc/* Hugetlb memory check */ if (vma_is_hugetlb (vma)) { -if ((vma->vm_flags &VM_SHARED ) && +if (vma_test (vma,VMA_SHARED_BIT ) &&COREDUMP_MEMORY_TYPE_INCLUDE (memory_types,HUGETLB_SHARED )) goto whole; -if (!(vma->vm_flags &VM_SHARED ) && +if (!vma_test (vma,VMA_SHARED_BIT ) &&COREDUMP_MEMORY_TYPE_INCLUDE (memory_types,HUGETLB_PRIVATE )) goto whole;return 0 ; }/* Do not dump I/O mapped devices or special mappings */ -if (vma->vm_flags &VM_IO ) +if (vma_test (vma,VMA_IO_BIT ))return 0 ;/* By default, dump shared memory if mapped from an anonymous file. */ -if (vma->vm_flags &VM_SHARED ) { +if (vma_test (vma,VMA_SHARED_BIT )) {if (file_inode (vma->vm_file)->i_nlink ==0 ?COREDUMP_MEMORY_TYPE_INCLUDE (memory_types,ANON_SHARED ) :COREDUMP_MEMORY_TYPE_INCLUDE (memory_types,FILE_SHARED ))
@@ -1890,7 +1890,7 @@ static unsigned long vma_dump_size(struc* dump the first page to aid in determining what was mapped here. */ if (COREDUMP_MEMORY_TYPE_INCLUDE (memory_types,ELF_HEADERS ) && - vma->vm_pgoff ==0 && (vma->vm_flags &VM_READ )) { + vma->vm_pgoff ==0 &&vma_test (vma,VMA_READ_BIT )) {if ((READ_ONCE (file_inode (vma->vm_file)->i_mode) &0111 ) !=0 )return PAGE_SIZE ;
_
Patches currently in -mm which might be from [email protected] are
mm-msync-return-enomem-if-page-aligned-length-overflows.patch mm-vma-drop-mm-asynchronously-in-vma_start_read.patch mm-vma-predicate-vma_assert_stabilised-on-config_debug_vm.patch mm-only-assert-mmap-locks-if-config_debug_vm-or-lockdep-is-set.patch mm-only-assert-vma-locks-if-config_debug_vm-is-set.patch mm-convert-warn_on_onces-to-vm_warn_on_once-in-vma-lock-code.patch mm-madvise-zap-markers-from-guard-regions.patch mm-mmap-free-gathered-pages-before-mmf_oom_skip.patch percpu-fix-contig-hints-that-are-too-low.patch percpu-search-the-whole-reserved-chunk.patch mm-filemap-convert-fault-and-readahead-logic-to-use-vma_flags_t.patch mm-madvise-convert-madvise_vma_behavior-to-use-vma_flags_t.patch mm-convert-miscellaneous-vma-flag-tests-to-use-vma_flags_t.patch fs-proc-task_mmu-convert-vma-flag-tests-to-use-vma_flags_t.patch fs-coredump-convert-vma_dump_size-to-use-vma_flags_t.patch uprobes-convert-vma-flag-tests-to-use-vma_flags_t.patch perf-convert-vma-flag-tests-to-use-vma_flags_t.patch selinux-convert-vma-flag-tests-to-use-vma_flags_t.patch apparmor-convert-vma-flag-tests-to-use-vma_flags_t.patch ima-convert-vma-flag-tests-to-use-vma_flags_t.patch ipe-convert-vma-flag-tests-to-use-vma_flags_t.patch
Lorenzo Stoakes (ARM)
maintainerPATCH v2 6/11 uprobes: convert VMA flag tests to use vma_flags_t
In reply to Lorenzo Stoakes (ARM)Replace use of the legacy vm_flags_t flags with vma_flags_t values in the uprobes VMA validity checks.
No functional change intended.
--- kernel/events/uprobes.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
kernel/events/uprobes.c +7 -5
@@ -134,12 +134,14 @@ static void uprobe_warn(struct task_struct *t, const char *msg)*/ static bool valid_vma (struct vm_area_struct *vma,bool is_register) { -vm_flags_t flags =VM_HUGETLB |VM_MAYEXEC |VM_MAYSHARE ; +vma_flags_t forbidden =mk_vma_flags (VMA_HUGETLB_BIT , +VMA_MAYSHARE_BIT );if (is_register) - flags |=VM_WRITE ; +vma_flags_set (&forbidden,VMA_WRITE_BIT ); -return vma->vm_file && (vma->vm_flags & flags) ==VM_MAYEXEC ; +return vma->vm_file &&vma_test (vma,VMA_MAYEXEC_BIT ) && + !vma_test_any_mask (vma, forbidden); }static unsigned long offset_to_vaddr (struct vm_area_struct *vma,loff_t offset)
@@ -286,7 +288,7 @@ static bool valid_ref_ctr_vma(struct uprobe *uprobe,return uprobe->ref_ctr_offset && vma->vm_file &&file_inode (vma->vm_file) == uprobe->inode && - (vma->vm_flags & (VM_WRITE |VM_SHARED )) ==VM_WRITE && +vma_test (vma,VMA_WRITE_BIT ) && !vma_test (vma,VMA_SHARED_BIT ) && vma->vm_start <= vaddr && vma->vm_end > vaddr; }
@@ -1607,7 +1609,7 @@ int uprobe_mmap(struct vm_area_struct *vma)return 0 ;if (vma->vm_file && - (vma->vm_flags & (VM_WRITE |VM_SHARED )) ==VM_WRITE && +vma_test (vma,VMA_WRITE_BIT ) && !vma_test (vma,VMA_SHARED_BIT ) &&mm_flags_test (MMF_HAS_UPROBES , vma->vm_mm))delayed_ref_ctr_inc (vma);
Signature · 1 line
2.56.1
+ uprobes-convert-vma-flag-tests-to-use-vma_flags_t.patch added to mm-new branch
The patch titled Subject: uprobes: convert VMA flag tests to use vma_flags_t has been added to the -mm mm-new branch. Its filename is uprobes-convert-vma-flag-tests-to-use-vma_flags_t.patch
The patch titled
Subject: uprobes: convert VMA flag tests to use vma_flags_t
has been added to the -mm mm-new branch. Its filename is
uprobes-convert-vma-flag-tests-to-use-vma_flags_t.patch
This patch will shortly appear at
https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/uprobes-convert-vma-flag-tests-to-use-vma_flags_t.patch
This patch will later appear in the mm-new branch at
git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Note, mm-new is a provisional staging ground for work-in-progress patches, and acceptance into mm-new is a notification for others take notice and to finish up reviews. Please do not hesitate to respond to review feedback and post updated versions to replace or incrementally fixup patches in mm-new.
The mm-new branch of mm.git is not included in linux-next
If a few days of testing in mm-new is successful, the patch will me moved into mm.git's mm-unstable branch, which is included in linux-next
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next via various branches at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there most days
------------------------------------------------------
From: "Lorenzo Stoakes (ARM)" <[email protected]>
Subject: uprobes: convert VMA flag tests to use vma_flags_t
Date: Tue, 24 Nov 2026 17:07:58 +0000
Replace use of the legacy vm_flags_t flags with vma_flags_t values in the uprobes VMA validity checks.
No functional change intended.
kernel/events/uprobes.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
kernel/events/uprobes.c renamed from kernel/events/uprobes.c~uprobes-convert-vma-flag-tests-to-use-vma_flags_t +7 -5
@@ -134,12 +134,14 @@ static void uprobe_warn(struct task_stru*/ static bool valid_vma (struct vm_area_struct *vma,bool is_register) { -vm_flags_t flags =VM_HUGETLB |VM_MAYEXEC |VM_MAYSHARE ; +vma_flags_t forbidden =mk_vma_flags (VMA_HUGETLB_BIT , +VMA_MAYSHARE_BIT );if (is_register) - flags |=VM_WRITE ; +vma_flags_set (&forbidden,VMA_WRITE_BIT ); -return vma->vm_file && (vma->vm_flags & flags) ==VM_MAYEXEC ; +return vma->vm_file &&vma_test (vma,VMA_MAYEXEC_BIT ) && + !vma_test_any_mask (vma, forbidden); }static unsigned long offset_to_vaddr (struct vm_area_struct *vma,loff_t offset)
@@ -286,7 +288,7 @@ static bool valid_ref_ctr_vma(struct uprreturn uprobe->ref_ctr_offset && vma->vm_file &&file_inode (vma->vm_file) == uprobe->inode && - (vma->vm_flags & (VM_WRITE |VM_SHARED )) ==VM_WRITE && +vma_test (vma,VMA_WRITE_BIT ) && !vma_test (vma,VMA_SHARED_BIT ) && vma->vm_start <= vaddr && vma->vm_end > vaddr; }
@@ -1607,7 +1609,7 @@ int uprobe_mmap(struct vm_area_struct *vreturn 0 ;if (vma->vm_file && - (vma->vm_flags & (VM_WRITE |VM_SHARED )) ==VM_WRITE && +vma_test (vma,VMA_WRITE_BIT ) && !vma_test (vma,VMA_SHARED_BIT ) &&mm_flags_test (MMF_HAS_UPROBES , vma->vm_mm))delayed_ref_ctr_inc (vma);
_
Patches currently in -mm which might be from [email protected] are
mm-msync-return-enomem-if-page-aligned-length-overflows.patch mm-vma-drop-mm-asynchronously-in-vma_start_read.patch mm-vma-predicate-vma_assert_stabilised-on-config_debug_vm.patch mm-only-assert-mmap-locks-if-config_debug_vm-or-lockdep-is-set.patch mm-only-assert-vma-locks-if-config_debug_vm-is-set.patch mm-convert-warn_on_onces-to-vm_warn_on_once-in-vma-lock-code.patch mm-madvise-zap-markers-from-guard-regions.patch mm-mmap-free-gathered-pages-before-mmf_oom_skip.patch percpu-fix-contig-hints-that-are-too-low.patch percpu-search-the-whole-reserved-chunk.patch mm-filemap-convert-fault-and-readahead-logic-to-use-vma_flags_t.patch mm-madvise-convert-madvise_vma_behavior-to-use-vma_flags_t.patch mm-convert-miscellaneous-vma-flag-tests-to-use-vma_flags_t.patch fs-proc-task_mmu-convert-vma-flag-tests-to-use-vma_flags_t.patch fs-coredump-convert-vma_dump_size-to-use-vma_flags_t.patch uprobes-convert-vma-flag-tests-to-use-vma_flags_t.patch perf-convert-vma-flag-tests-to-use-vma_flags_t.patch selinux-convert-vma-flag-tests-to-use-vma_flags_t.patch apparmor-convert-vma-flag-tests-to-use-vma_flags_t.patch ima-convert-vma-flag-tests-to-use-vma_flags_t.patch ipe-convert-vma-flag-tests-to-use-vma_flags_t.patch
Lorenzo Stoakes (ARM)
maintainerPATCH v2 7/11 perf: convert VMA flag tests to use vma_flags_t
In reply to Lorenzo Stoakes (ARM)Replace use of the legacy vm_flags_t flags with vma_flags_t values in the perf mmap and mmap event logic.
No functional change intended.
--- kernel/events/core.c | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-)
kernel/events/core.c +14 -12
@@ -7234,6 +7234,7 @@ static int map_range(struct perf_buffer *rb, struct vm_area_struct *vma)unsigned long va = vma->vm_start +PAGE_SIZE * pagenum;struct page *page =perf_mmap_to_page (rb,vma_start_pgoff (vma) + pagenum); +vma_flags_t vma_flags = vma->flags;if (page ==NULL ) { err = -EINVAL ;
@@ -7241,8 +7242,9 @@ static int map_range(struct perf_buffer *rb, struct vm_area_struct *vma) }/* Map readonly, perf_mmap_pfn_mkwrite() called on write fault. */ +vma_flags_clear (&vma_flags,VMA_SHARED_BIT ); err =remap_pfn_range (vma, va,page_to_pfn (page),PAGE_SIZE , -vm_get_page_prot (vma->vm_flags & ~VM_SHARED )); +vma_flags_to_page_prot (vma_flags));if (err)break ; }
@@ -7360,7 +7362,7 @@ static int perf_mmap_rb(struct vm_area_struct *vma, struct perf_event *event,if (!perf_mmap_calc_limits (vma, &user_extra, &extra))return -EPERM ; -if (vma->vm_flags &VM_WRITE ) +if (vma_test (vma,VMA_WRITE_BIT )) rb_flags |=RING_BUFFER_WRITABLE ; rb = rb_alloc(nr_pages,
@@ -7441,7 +7443,7 @@ static int perf_mmap_aux(struct vm_area_struct *vma, struct perf_event *event,WARN_ON (!rb && event->rb); -if (vma->vm_flags &VM_WRITE ) +if (vma_test (vma,VMA_WRITE_BIT )) rb_flags |=RING_BUFFER_WRITABLE ; ret = rb_alloc_aux(rb, event, pgoff_start, nr_pages,
@@ -7476,7 +7478,7 @@ static int perf_mmap(struct file *file, struct vm_area_struct *vma)if (event->cpu ==-1 && event->attr.inherit)return -EINVAL ; -if (!(vma->vm_flags &VM_SHARED )) +if (!vma_test (vma,VMA_SHARED_BIT ))return -EINVAL ; ret =security_perf_event_read (event);
@@ -9848,7 +9850,7 @@ static int perf_event_mmap_match(struct perf_event *event, {struct perf_mmap_event *mmap_event = data;struct vm_area_struct *vma = mmap_event->vma; -int executable = vma->vm_flags &VM_EXEC ; +bool executable =vma_test (vma,VMA_EXEC_BIT );return (!executable && event->attr.mmap_data) || (executable && (event->attr.mmap || event->attr.mmap2));
@@ -9881,7 +9883,7 @@ static void perf_event_mmap_output(struct perf_event *event,if (use_build_id) misc |=PERF_RECORD_MISC_MMAP_BUILD_ID ; } -if (!(mmap_event->vma->vm_flags &VM_EXEC )) +if (!vma_test (mmap_event->vma,VMA_EXEC_BIT )) misc |=PERF_RECORD_MISC_MMAP_DATA ; perf_event_header__init(&mmap_event->event_id.header, &sample,
@@ -9932,19 +9934,19 @@ static void perf_event_mmap_event(struct perf_mmap_event *mmap_event)char *buf =NULL ;char *name =NULL ; -if (vma->vm_flags &VM_READ ) +if (vma_test (vma,VMA_READ_BIT )) prot |=PROT_READ ; -if (vma->vm_flags &VM_WRITE ) +if (vma_test (vma,VMA_WRITE_BIT )) prot |=PROT_WRITE ; -if (vma->vm_flags &VM_EXEC ) +if (vma_test (vma,VMA_EXEC_BIT )) prot |=PROT_EXEC ; -if (vma->vm_flags &VM_MAYSHARE ) +if (vma_test (vma,VMA_MAYSHARE_BIT )) flags =MAP_SHARED ;else flags =MAP_PRIVATE ; -if (vma->vm_flags &VM_LOCKED ) +if (vma_test (vma,VMA_LOCKED_BIT )) flags |=MAP_LOCKED ;if (vma_is_hugetlb (vma)) flags |=MAP_HUGETLB ;
@@ -10110,7 +10112,7 @@ static void perf_addr_filters_adjust(struct vm_area_struct *vma)* Data tracing isn't supported yet and as such there is no need * to keep track of anything that isn't related to executable code: */ -if (!(vma->vm_flags &VM_EXEC )) +if (!vma_test (vma,VMA_EXEC_BIT ))return ;rcu_read_lock ();
Signature · 1 line
2.56.1
+ perf-convert-vma-flag-tests-to-use-vma_flags_t.patch added to mm-new branch
The patch titled Subject: perf: convert VMA flag tests to use vma_flags_t has been added to the -mm mm-new branch. Its filename is perf-convert-vma-flag-tests-to-use-vma_flags_t.patch
The patch titled
Subject: perf: convert VMA flag tests to use vma_flags_t
has been added to the -mm mm-new branch. Its filename is
perf-convert-vma-flag-tests-to-use-vma_flags_t.patch
This patch will shortly appear at
https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/perf-convert-vma-flag-tests-to-use-vma_flags_t.patch
This patch will later appear in the mm-new branch at
git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Note, mm-new is a provisional staging ground for work-in-progress patches, and acceptance into mm-new is a notification for others take notice and to finish up reviews. Please do not hesitate to respond to review feedback and post updated versions to replace or incrementally fixup patches in mm-new.
The mm-new branch of mm.git is not included in linux-next
If a few days of testing in mm-new is successful, the patch will me moved into mm.git's mm-unstable branch, which is included in linux-next
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next via various branches at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there most days
------------------------------------------------------
From: "Lorenzo Stoakes (ARM)" <[email protected]>
Subject: perf: convert VMA flag tests to use vma_flags_t
Date: Tue, 24 Nov 2026 17:07:59 +0000
Replace use of the legacy vm_flags_t flags with vma_flags_t values in the perf mmap and mmap event logic.
No functional change intended.
kernel/events/core.c | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-)
kernel/events/core.c renamed from kernel/events/core.c~perf-convert-vma-flag-tests-to-use-vma_flags_t +14 -12
@@ -7234,6 +7234,7 @@ static int map_range(struct perf_bufferunsigned long va = vma->vm_start +PAGE_SIZE * pagenum;struct page *page =perf_mmap_to_page (rb,vma_start_pgoff (vma) + pagenum); +vma_flags_t vma_flags = vma->flags;if (page ==NULL ) { err = -EINVAL ;
@@ -7241,8 +7242,9 @@ static int map_range(struct perf_buffer }/* Map readonly, perf_mmap_pfn_mkwrite() called on write fault. */ +vma_flags_clear (&vma_flags,VMA_SHARED_BIT ); err =remap_pfn_range (vma, va,page_to_pfn (page),PAGE_SIZE , -vm_get_page_prot (vma->vm_flags & ~VM_SHARED )); +vma_flags_to_page_prot (vma_flags));if (err)break ; }
@@ -7360,7 +7362,7 @@ static int perf_mmap_rb(struct vm_area_sif (!perf_mmap_calc_limits (vma, &user_extra, &extra))return -EPERM ; -if (vma->vm_flags &VM_WRITE ) +if (vma_test (vma,VMA_WRITE_BIT )) rb_flags |=RING_BUFFER_WRITABLE ; rb = rb_alloc(nr_pages,
@@ -7441,7 +7443,7 @@ static int perf_mmap_aux(struct vm_area_WARN_ON (!rb && event->rb); -if (vma->vm_flags &VM_WRITE ) +if (vma_test (vma,VMA_WRITE_BIT )) rb_flags |=RING_BUFFER_WRITABLE ; ret = rb_alloc_aux(rb, event, pgoff_start, nr_pages,
@@ -7476,7 +7478,7 @@ static int perf_mmap(struct file *file,if (event->cpu ==-1 && event->attr.inherit)return -EINVAL ; -if (!(vma->vm_flags &VM_SHARED )) +if (!vma_test (vma,VMA_SHARED_BIT ))return -EINVAL ; ret =security_perf_event_read (event);
@@ -9848,7 +9850,7 @@ static int perf_event_mmap_match(struct {struct perf_mmap_event *mmap_event = data;struct vm_area_struct *vma = mmap_event->vma; -int executable = vma->vm_flags &VM_EXEC ; +bool executable =vma_test (vma,VMA_EXEC_BIT );return (!executable && event->attr.mmap_data) || (executable && (event->attr.mmap || event->attr.mmap2));
@@ -9881,7 +9883,7 @@ static void perf_event_mmap_output(strucif (use_build_id) misc |=PERF_RECORD_MISC_MMAP_BUILD_ID ; } -if (!(mmap_event->vma->vm_flags &VM_EXEC )) +if (!vma_test (mmap_event->vma,VMA_EXEC_BIT )) misc |=PERF_RECORD_MISC_MMAP_DATA ; perf_event_header__init(&mmap_event->event_id.header, &sample,
@@ -9932,19 +9934,19 @@ static void perf_event_mmap_event(structchar *buf =NULL ;char *name =NULL ; -if (vma->vm_flags &VM_READ ) +if (vma_test (vma,VMA_READ_BIT )) prot |=PROT_READ ; -if (vma->vm_flags &VM_WRITE ) +if (vma_test (vma,VMA_WRITE_BIT )) prot |=PROT_WRITE ; -if (vma->vm_flags &VM_EXEC ) +if (vma_test (vma,VMA_EXEC_BIT )) prot |=PROT_EXEC ; -if (vma->vm_flags &VM_MAYSHARE ) +if (vma_test (vma,VMA_MAYSHARE_BIT )) flags =MAP_SHARED ;else flags =MAP_PRIVATE ; -if (vma->vm_flags &VM_LOCKED ) +if (vma_test (vma,VMA_LOCKED_BIT )) flags |=MAP_LOCKED ;if (vma_is_hugetlb (vma)) flags |=MAP_HUGETLB ;
@@ -10110,7 +10112,7 @@ static void perf_addr_filters_adjust(str* Data tracing isn't supported yet and as such there is no need * to keep track of anything that isn't related to executable code: */ -if (!(vma->vm_flags &VM_EXEC )) +if (!vma_test (vma,VMA_EXEC_BIT ))return ;rcu_read_lock ();
_
Patches currently in -mm which might be from [email protected] are
mm-msync-return-enomem-if-page-aligned-length-overflows.patch mm-vma-drop-mm-asynchronously-in-vma_start_read.patch mm-vma-predicate-vma_assert_stabilised-on-config_debug_vm.patch mm-only-assert-mmap-locks-if-config_debug_vm-or-lockdep-is-set.patch mm-only-assert-vma-locks-if-config_debug_vm-is-set.patch mm-convert-warn_on_onces-to-vm_warn_on_once-in-vma-lock-code.patch mm-madvise-zap-markers-from-guard-regions.patch mm-mmap-free-gathered-pages-before-mmf_oom_skip.patch percpu-fix-contig-hints-that-are-too-low.patch percpu-search-the-whole-reserved-chunk.patch mm-filemap-convert-fault-and-readahead-logic-to-use-vma_flags_t.patch mm-madvise-convert-madvise_vma_behavior-to-use-vma_flags_t.patch mm-convert-miscellaneous-vma-flag-tests-to-use-vma_flags_t.patch fs-proc-task_mmu-convert-vma-flag-tests-to-use-vma_flags_t.patch fs-coredump-convert-vma_dump_size-to-use-vma_flags_t.patch uprobes-convert-vma-flag-tests-to-use-vma_flags_t.patch perf-convert-vma-flag-tests-to-use-vma_flags_t.patch selinux-convert-vma-flag-tests-to-use-vma_flags_t.patch apparmor-convert-vma-flag-tests-to-use-vma_flags_t.patch ima-convert-vma-flag-tests-to-use-vma_flags_t.patch ipe-convert-vma-flag-tests-to-use-vma_flags_t.patch
Lorenzo Stoakes (ARM)
maintainerPATCH v2 8/11 selinux: convert VMA flag tests to use vma_flags_t
In reply to Lorenzo Stoakes (ARM)Replace use of the legacy vm_flags_t flags with vma_flags_t values in the SELinux mmap backing file and mprotect LSM hooks.
No functional change intended.
--- security/selinux/hooks.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
security/selinux/hooks.c +7 -7
@@ -4205,16 +4205,16 @@ static int selinux_mmap_backing_file(struct vm_area_struct *vma, {unsigned long prot =0 ; -/* translate vma->vm_flags perms into PROT perms */ -if (vma->vm_flags &VM_READ ) +/* translate VMA flag perms into PROT perms */ +if (vma_test (vma,VMA_READ_BIT )) prot |=PROT_READ ; -if (vma->vm_flags &VM_WRITE ) +if (vma_test (vma,VMA_WRITE_BIT )) prot |=PROT_WRITE ; -if (vma->vm_flags &VM_EXEC ) +if (vma_test (vma,VMA_EXEC_BIT )) prot |=PROT_EXEC ;return selinux_mmap_file_common (backing_file, prot, - vma->vm_flags &VM_SHARED , +vma_test (vma,VMA_SHARED_BIT ), true); }
@@ -4228,13 +4228,13 @@ static int selinux_file_mprotect(struct vm_area_struct *vma,u32 av;const struct file *file = vma->vm_file;bool backing_file; -bool shared = vma->vm_flags &VM_SHARED ; +bool shared =vma_test (vma,VMA_SHARED_BIT );/* check if we need to trigger the "backing files are awful" mode */ backing_file = file && (file->f_mode &FMODE_BACKING );if (default_noexec && - (prot &PROT_EXEC ) && !(vma->vm_flags &VM_EXEC )) { + (prot &PROT_EXEC ) && !vma_test (vma,VMA_EXEC_BIT )) {/* * We don't use the vma_is_initial_heap() helper as it has * a history of problems and is currently broken on systems
Signature · 1 line
2.56.1
+ selinux-convert-vma-flag-tests-to-use-vma_flags_t.patch added to mm-new branch
The patch titled Subject: selinux: convert VMA flag tests to use vma_flags_t has been added to the -mm mm-new branch. Its filename is selinux-convert-vma-flag-tests-to-use-vma_flags_t.patch
The patch titled
Subject: selinux: convert VMA flag tests to use vma_flags_t
has been added to the -mm mm-new branch. Its filename is
selinux-convert-vma-flag-tests-to-use-vma_flags_t.patch
This patch will shortly appear at
https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/selinux-convert-vma-flag-tests-to-use-vma_flags_t.patch
This patch will later appear in the mm-new branch at
git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Note, mm-new is a provisional staging ground for work-in-progress patches, and acceptance into mm-new is a notification for others take notice and to finish up reviews. Please do not hesitate to respond to review feedback and post updated versions to replace or incrementally fixup patches in mm-new.
The mm-new branch of mm.git is not included in linux-next
If a few days of testing in mm-new is successful, the patch will me moved into mm.git's mm-unstable branch, which is included in linux-next
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next via various branches at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there most days
------------------------------------------------------
From: "Lorenzo Stoakes (ARM)" <[email protected]>
Subject: selinux: convert VMA flag tests to use vma_flags_t
Date: Tue, 24 Nov 2026 17:08:00 +0000
Replace use of the legacy vm_flags_t flags with vma_flags_t values in the SELinux mmap backing file and mprotect LSM hooks.
No functional change intended.
security/selinux/hooks.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
security/selinux/hooks.c renamed from security/selinux/hooks.c~selinux-convert-vma-flag-tests-to-use-vma_flags_t +7 -7
@@ -4205,16 +4205,16 @@ static int selinux_mmap_backing_file(str {unsigned long prot =0 ; -/* translate vma->vm_flags perms into PROT perms */ -if (vma->vm_flags &VM_READ ) +/* translate VMA flag perms into PROT perms */ +if (vma_test (vma,VMA_READ_BIT )) prot |=PROT_READ ; -if (vma->vm_flags &VM_WRITE ) +if (vma_test (vma,VMA_WRITE_BIT )) prot |=PROT_WRITE ; -if (vma->vm_flags &VM_EXEC ) +if (vma_test (vma,VMA_EXEC_BIT )) prot |=PROT_EXEC ;return selinux_mmap_file_common (backing_file, prot, - vma->vm_flags &VM_SHARED , +vma_test (vma,VMA_SHARED_BIT ), true); }
@@ -4228,13 +4228,13 @@ static int selinux_file_mprotect(structu32 av;const struct file *file = vma->vm_file;bool backing_file; -bool shared = vma->vm_flags &VM_SHARED ; +bool shared =vma_test (vma,VMA_SHARED_BIT );/* check if we need to trigger the "backing files are awful" mode */ backing_file = file && (file->f_mode &FMODE_BACKING );if (default_noexec && - (prot &PROT_EXEC ) && !(vma->vm_flags &VM_EXEC )) { + (prot &PROT_EXEC ) && !vma_test (vma,VMA_EXEC_BIT )) {/* * We don't use the vma_is_initial_heap() helper as it has * a history of problems and is currently broken on systems
_
Patches currently in -mm which might be from [email protected] are
mm-msync-return-enomem-if-page-aligned-length-overflows.patch mm-vma-drop-mm-asynchronously-in-vma_start_read.patch mm-vma-predicate-vma_assert_stabilised-on-config_debug_vm.patch mm-only-assert-mmap-locks-if-config_debug_vm-or-lockdep-is-set.patch mm-only-assert-vma-locks-if-config_debug_vm-is-set.patch mm-convert-warn_on_onces-to-vm_warn_on_once-in-vma-lock-code.patch mm-madvise-zap-markers-from-guard-regions.patch mm-mmap-free-gathered-pages-before-mmf_oom_skip.patch percpu-fix-contig-hints-that-are-too-low.patch percpu-search-the-whole-reserved-chunk.patch mm-filemap-convert-fault-and-readahead-logic-to-use-vma_flags_t.patch mm-madvise-convert-madvise_vma_behavior-to-use-vma_flags_t.patch mm-convert-miscellaneous-vma-flag-tests-to-use-vma_flags_t.patch fs-proc-task_mmu-convert-vma-flag-tests-to-use-vma_flags_t.patch fs-coredump-convert-vma_dump_size-to-use-vma_flags_t.patch uprobes-convert-vma-flag-tests-to-use-vma_flags_t.patch perf-convert-vma-flag-tests-to-use-vma_flags_t.patch selinux-convert-vma-flag-tests-to-use-vma_flags_t.patch apparmor-convert-vma-flag-tests-to-use-vma_flags_t.patch ima-convert-vma-flag-tests-to-use-vma_flags_t.patch ipe-convert-vma-flag-tests-to-use-vma_flags_t.patch
Lorenzo Stoakes (ARM)
maintainerPATCH v2 9/11 apparmor: convert VMA flag tests to use vma_flags_t
In reply to Lorenzo Stoakes (ARM)Replace use of the legacy vm_flags_t flags with vma_flags_t values in the AppArmor mprotect LSM hook.
No functional change intended.
--- security/apparmor/lsm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
security/apparmor/lsm.c +1 -1
@@ -591,7 +591,7 @@ static int apparmor_file_mprotect(struct vm_area_struct *vma, unsigned long reqprot, unsigned long prot) {return common_mmap (OP_FMPROT , vma->vm_file, prot, - !(vma->vm_flags &VM_SHARED ) ?MAP_PRIVATE :0 ); + !vma_test (vma,VMA_SHARED_BIT ) ?MAP_PRIVATE :0 ); }#ifdef CONFIG_IO_URING
Signature · 1 line
2.56.1
+ apparmor-convert-vma-flag-tests-to-use-vma_flags_t.patch added to mm-new branch
The patch titled Subject: apparmor: convert VMA flag tests to use vma_flags_t has been added to the -mm mm-new branch. Its filename is apparmor-convert-vma-flag-tests-to-use-vma_flags_t.patch
The patch titled
Subject: apparmor: convert VMA flag tests to use vma_flags_t
has been added to the -mm mm-new branch. Its filename is
apparmor-convert-vma-flag-tests-to-use-vma_flags_t.patch
This patch will shortly appear at
https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/apparmor-convert-vma-flag-tests-to-use-vma_flags_t.patch
This patch will later appear in the mm-new branch at
git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Note, mm-new is a provisional staging ground for work-in-progress patches, and acceptance into mm-new is a notification for others take notice and to finish up reviews. Please do not hesitate to respond to review feedback and post updated versions to replace or incrementally fixup patches in mm-new.
The mm-new branch of mm.git is not included in linux-next
If a few days of testing in mm-new is successful, the patch will me moved into mm.git's mm-unstable branch, which is included in linux-next
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next via various branches at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there most days
------------------------------------------------------
From: "Lorenzo Stoakes (ARM)" <[email protected]>
Subject: apparmor: convert VMA flag tests to use vma_flags_t
Date: Tue, 24 Nov 2026 17:08:01 +0000
Replace use of the legacy vm_flags_t flags with vma_flags_t values in the AppArmor mprotect LSM hook.
No functional change intended.
security/apparmor/lsm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
security/apparmor/lsm.c renamed from security/apparmor/lsm.c~apparmor-convert-vma-flag-tests-to-use-vma_flags_t +1 -1
@@ -591,7 +591,7 @@ static int apparmor_file_mprotect(struct unsigned long reqprot, unsigned long prot) {return common_mmap (OP_FMPROT , vma->vm_file, prot, - !(vma->vm_flags &VM_SHARED ) ?MAP_PRIVATE :0 ); + !vma_test (vma,VMA_SHARED_BIT ) ?MAP_PRIVATE :0 ); }#ifdef CONFIG_IO_URING
_
Patches currently in -mm which might be from [email protected] are
mm-msync-return-enomem-if-page-aligned-length-overflows.patch mm-vma-drop-mm-asynchronously-in-vma_start_read.patch mm-vma-predicate-vma_assert_stabilised-on-config_debug_vm.patch mm-only-assert-mmap-locks-if-config_debug_vm-or-lockdep-is-set.patch mm-only-assert-vma-locks-if-config_debug_vm-is-set.patch mm-convert-warn_on_onces-to-vm_warn_on_once-in-vma-lock-code.patch mm-madvise-zap-markers-from-guard-regions.patch mm-mmap-free-gathered-pages-before-mmf_oom_skip.patch percpu-fix-contig-hints-that-are-too-low.patch percpu-search-the-whole-reserved-chunk.patch mm-filemap-convert-fault-and-readahead-logic-to-use-vma_flags_t.patch mm-madvise-convert-madvise_vma_behavior-to-use-vma_flags_t.patch mm-convert-miscellaneous-vma-flag-tests-to-use-vma_flags_t.patch fs-proc-task_mmu-convert-vma-flag-tests-to-use-vma_flags_t.patch fs-coredump-convert-vma_dump_size-to-use-vma_flags_t.patch uprobes-convert-vma-flag-tests-to-use-vma_flags_t.patch perf-convert-vma-flag-tests-to-use-vma_flags_t.patch selinux-convert-vma-flag-tests-to-use-vma_flags_t.patch apparmor-convert-vma-flag-tests-to-use-vma_flags_t.patch ima-convert-vma-flag-tests-to-use-vma_flags_t.patch ipe-convert-vma-flag-tests-to-use-vma_flags_t.patch
Lorenzo Stoakes (ARM)
maintainerPATCH v2 10/11 ima: convert VMA flag tests to use vma_flags_t
In reply to Lorenzo Stoakes (ARM)Replace use of the legacy vm_flags_t flags with vma_flags_t values in the IMA mprotect LSM hook.
No functional change intended.
--- security/integrity/ima/ima_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
security/integrity/ima/ima_main.c +1 -1
@@ -556,7 +556,7 @@ static int ima_file_mprotect(struct vm_area_struct *vma, unsigned long reqprot,/* Is mprotect making an mmap'ed file executable? */ if (!(ima_policy_flag &IMA_APPRAISE ) || !vma->vm_file || - !(prot &PROT_EXEC ) || (vma->vm_flags &VM_EXEC )) + !(prot &PROT_EXEC ) ||vma_test (vma,VMA_EXEC_BIT ))return 0 ;security_current_getlsmprop_subj (&prop);
Signature · 1 line
2.56.1
+ ima-convert-vma-flag-tests-to-use-vma_flags_t.patch added to mm-new branch
The patch titled Subject: ima: convert VMA flag tests to use vma_flags_t has been added to the -mm mm-new branch. Its filename is ima-convert-vma-flag-tests-to-use-vma_flags_t.patch
The patch titled
Subject: ima: convert VMA flag tests to use vma_flags_t
has been added to the -mm mm-new branch. Its filename is
ima-convert-vma-flag-tests-to-use-vma_flags_t.patch
This patch will shortly appear at
https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/ima-convert-vma-flag-tests-to-use-vma_flags_t.patch
This patch will later appear in the mm-new branch at
git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Note, mm-new is a provisional staging ground for work-in-progress patches, and acceptance into mm-new is a notification for others take notice and to finish up reviews. Please do not hesitate to respond to review feedback and post updated versions to replace or incrementally fixup patches in mm-new.
The mm-new branch of mm.git is not included in linux-next
If a few days of testing in mm-new is successful, the patch will me moved into mm.git's mm-unstable branch, which is included in linux-next
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next via various branches at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there most days
------------------------------------------------------
From: "Lorenzo Stoakes (ARM)" <[email protected]>
Subject: ima: convert VMA flag tests to use vma_flags_t
Date: Tue, 24 Nov 2026 17:08:02 +0000
Replace use of the legacy vm_flags_t flags with vma_flags_t values in the IMA mprotect LSM hook.
No functional change intended.
security/integrity/ima/ima_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
security/integrity/ima/ima_main.c renamed from security/integrity/ima/ima_main.c~ima-convert-vma-flag-tests-to-use-vma_flags_t +1 -1
@@ -556,7 +556,7 @@ static int ima_file_mprotect(struct vm_a/* Is mprotect making an mmap'ed file executable? */ if (!(ima_policy_flag &IMA_APPRAISE ) || !vma->vm_file || - !(prot &PROT_EXEC ) || (vma->vm_flags &VM_EXEC )) + !(prot &PROT_EXEC ) ||vma_test (vma,VMA_EXEC_BIT ))return 0 ;security_current_getlsmprop_subj (&prop);
_
Patches currently in -mm which might be from [email protected] are
mm-msync-return-enomem-if-page-aligned-length-overflows.patch mm-vma-drop-mm-asynchronously-in-vma_start_read.patch mm-vma-predicate-vma_assert_stabilised-on-config_debug_vm.patch mm-only-assert-mmap-locks-if-config_debug_vm-or-lockdep-is-set.patch mm-only-assert-vma-locks-if-config_debug_vm-is-set.patch mm-convert-warn_on_onces-to-vm_warn_on_once-in-vma-lock-code.patch mm-madvise-zap-markers-from-guard-regions.patch mm-mmap-free-gathered-pages-before-mmf_oom_skip.patch percpu-fix-contig-hints-that-are-too-low.patch percpu-search-the-whole-reserved-chunk.patch mm-filemap-convert-fault-and-readahead-logic-to-use-vma_flags_t.patch mm-madvise-convert-madvise_vma_behavior-to-use-vma_flags_t.patch mm-convert-miscellaneous-vma-flag-tests-to-use-vma_flags_t.patch fs-proc-task_mmu-convert-vma-flag-tests-to-use-vma_flags_t.patch fs-coredump-convert-vma_dump_size-to-use-vma_flags_t.patch uprobes-convert-vma-flag-tests-to-use-vma_flags_t.patch perf-convert-vma-flag-tests-to-use-vma_flags_t.patch selinux-convert-vma-flag-tests-to-use-vma_flags_t.patch apparmor-convert-vma-flag-tests-to-use-vma_flags_t.patch ima-convert-vma-flag-tests-to-use-vma_flags_t.patch ipe-convert-vma-flag-tests-to-use-vma_flags_t.patch
Lorenzo Stoakes (ARM)
maintainerPATCH v2 11/11 ipe: convert VMA flag tests to use vma_flags_t
In reply to Lorenzo Stoakes (ARM)Replace use of the legacy vm_flags_t flags with vma_flags_t values in the IPE mprotect LSM hook.
No functional change intended.
--- security/ipe/hooks.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
security/ipe/hooks.c +1 -1
@@ -112,7 +112,7 @@ int ipe_file_mprotect(struct vm_area_struct *vma,struct ipe_eval_ctx ctx =IPE_EVAL_CTX_INIT ;/* Already Executable */ -if (vma->vm_flags &VM_EXEC ) +if (vma_test (vma,VMA_EXEC_BIT ))return 0 ;if (prot &PROT_EXEC ) {
Signature · 1 line
2.56.1
+ ipe-convert-vma-flag-tests-to-use-vma_flags_t.patch added to mm-new branch
The patch titled Subject: ipe: convert VMA flag tests to use vma_flags_t has been added to the -mm mm-new branch. Its filename is ipe-convert-vma-flag-tests-to-use-vma_flags_t.patch
The patch titled
Subject: ipe: convert VMA flag tests to use vma_flags_t
has been added to the -mm mm-new branch. Its filename is
ipe-convert-vma-flag-tests-to-use-vma_flags_t.patch
This patch will shortly appear at
https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/ipe-convert-vma-flag-tests-to-use-vma_flags_t.patch
This patch will later appear in the mm-new branch at
git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Note, mm-new is a provisional staging ground for work-in-progress patches, and acceptance into mm-new is a notification for others take notice and to finish up reviews. Please do not hesitate to respond to review feedback and post updated versions to replace or incrementally fixup patches in mm-new.
The mm-new branch of mm.git is not included in linux-next
If a few days of testing in mm-new is successful, the patch will me moved into mm.git's mm-unstable branch, which is included in linux-next
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next via various branches at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there most days
------------------------------------------------------
From: "Lorenzo Stoakes (ARM)" <[email protected]>
Subject: ipe: convert VMA flag tests to use vma_flags_t
Date: Tue, 24 Nov 2026 17:08:03 +0000
Replace use of the legacy vm_flags_t flags with vma_flags_t values in the IPE mprotect LSM hook.
No functional change intended.
security/ipe/hooks.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
security/ipe/hooks.c renamed from security/ipe/hooks.c~ipe-convert-vma-flag-tests-to-use-vma_flags_t +1 -1
@@ -112,7 +112,7 @@ int ipe_file_mprotect(struct vm_area_strstruct ipe_eval_ctx ctx =IPE_EVAL_CTX_INIT ;/* Already Executable */ -if (vma->vm_flags &VM_EXEC ) +if (vma_test (vma,VMA_EXEC_BIT ))return 0 ;if (prot &PROT_EXEC ) {
_
Patches currently in -mm which might be from [email protected] are
mm-msync-return-enomem-if-page-aligned-length-overflows.patch mm-vma-drop-mm-asynchronously-in-vma_start_read.patch mm-vma-predicate-vma_assert_stabilised-on-config_debug_vm.patch mm-only-assert-mmap-locks-if-config_debug_vm-or-lockdep-is-set.patch mm-only-assert-vma-locks-if-config_debug_vm-is-set.patch mm-convert-warn_on_onces-to-vm_warn_on_once-in-vma-lock-code.patch mm-madvise-zap-markers-from-guard-regions.patch mm-mmap-free-gathered-pages-before-mmf_oom_skip.patch percpu-fix-contig-hints-that-are-too-low.patch percpu-search-the-whole-reserved-chunk.patch mm-filemap-convert-fault-and-readahead-logic-to-use-vma_flags_t.patch mm-madvise-convert-madvise_vma_behavior-to-use-vma_flags_t.patch mm-convert-miscellaneous-vma-flag-tests-to-use-vma_flags_t.patch fs-proc-task_mmu-convert-vma-flag-tests-to-use-vma_flags_t.patch fs-coredump-convert-vma_dump_size-to-use-vma_flags_t.patch uprobes-convert-vma-flag-tests-to-use-vma_flags_t.patch perf-convert-vma-flag-tests-to-use-vma_flags_t.patch selinux-convert-vma-flag-tests-to-use-vma_flags_t.patch apparmor-convert-vma-flag-tests-to-use-vma_flags_t.patch ima-convert-vma-flag-tests-to-use-vma_flags_t.patch ipe-convert-vma-flag-tests-to-use-vma_flags_t.patch
[email protected]
AI reviewSashiko has reviewed this 11-patch series and found no issues.
Sashiko has reviewed this 11-patch series and found no issues.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]