mm-simplify-vma-flag-tests-of-excluded-flags.patch removed from -mm tree
The quilt patch titled
Subject: mm: simplify VMA flag tests of excluded flags
has been removed from the -mm tree. Its filename was
mm-simplify-vma-flag-tests-of-excluded-flags.patch
This patch was dropped because it was merged into the mm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
------------------------------------------------------
From: "Lorenzo Stoakes (Oracle)" <[email protected]>
Subject: mm: simplify VMA flag tests of excluded flags
Date: Fri, 20 Mar 2026 19:38:42 +0000
We have implemented flag mask comparisons of the form:
if ((vm_flags & (VM_FOO|VM_BAR|VM_BAZ) == VM_FOO) { ... }
Like-for-like in the code using a bitwise-and mask via vma_flags_and() and using vma_flags_same() to ensure the final result equals only the required flag value.
This is fine but confusing, make things clearer by instead explicitly excluding undesired flags and including the desired one via tests of the form:
if (vma_flags_test(&flags, VMA_FOO_BIT) &&
!vma_flags_test_any(&flags, VMA_BAR_BIT, VMA_BAZ_BIT)) { ... }Which makes it easier to understand what is going on.
No functional change intended.
---
mm/mprotect.c | 12 ++++-------- mm/vma.c | 7 +++---- mm/vma.h | 6 ++---- 3 files changed, 9 insertions(+), 16 deletions(-)
mm/mprotect.c renamed from mm/mprotect.c~mm-simplify-vma-flag-tests-of-excluded-flags +4 -8
@@ -784,14 +784,10 @@ mprotect_fixup(struct vma_iterator *vmi,* Private VM_LOCKED VMA becoming writable: trigger COW to avoid major * fault on access. */ -if (vma_flags_test (&new_vma_flags,VMA_WRITE_BIT )) { -const vma_flags_t mask = -vma_flags_and (&old_vma_flags,VMA_WRITE_BIT , -VMA_SHARED_BIT ,VMA_LOCKED_BIT ); - -if (vma_flags_same (&mask,VMA_LOCKED_BIT )) -populate_vma_page_range (vma, start, end,NULL ); - } +if (vma_flags_test (&new_vma_flags,VMA_WRITE_BIT ) && +vma_flags_test (&old_vma_flags,VMA_LOCKED_BIT ) && + !vma_flags_test_any (&old_vma_flags,VMA_WRITE_BIT ,VMA_SHARED_BIT )) +populate_vma_page_range (vma, start, end,NULL );vm_stat_account (mm,vma_flags_to_legacy (old_vma_flags), -nrpages); newflags =vma_flags_to_legacy (new_vma_flags);
mm/vma.c renamed from mm/vma.c~mm-simplify-vma-flag-tests-of-excluded-flags +3 -4
@@ -2343,7 +2343,6 @@ void mm_drop_all_locks(struct mm_structstatic bool accountable_mapping (struct mmap_state *map) {const struct file *file = map->file; -vma_flags_t mask;/* * hugetlb has its own accounting separate from the core VM
@@ -2352,9 +2351,9 @@ static bool accountable_mapping(struct mif (file &&is_file_hugepages (file))return false; - mask =vma_flags_and (&map->vma_flags,VMA_NORESERVE_BIT ,VMA_SHARED_BIT , -VMA_WRITE_BIT ); -return vma_flags_same (&mask,VMA_WRITE_BIT ); +return vma_flags_test (&map->vma_flags,VMA_WRITE_BIT ) && + !vma_flags_test_any (&map->vma_flags,VMA_NORESERVE_BIT , +VMA_SHARED_BIT ); }/*
mm/vma.h renamed from mm/vma.h~mm-simplify-vma-flag-tests-of-excluded-flags +2 -4
@@ -529,10 +529,8 @@ static inline bool is_data_mapping(vm_flstatic inline bool is_data_mapping_vma_flags (const vma_flags_t *vma_flags) { -const vma_flags_t mask =vma_flags_and (vma_flags, -VMA_WRITE_BIT ,VMA_SHARED_BIT ,VMA_STACK_BIT ); - -return vma_flags_same (&mask,VMA_WRITE_BIT ); +return vma_flags_test (vma_flags,VMA_WRITE_BIT ) && + !vma_flags_test_any (vma_flags,VMA_SHARED_BIT ,VMA_STACK_BIT ); } static inline void vma_iter_config(struct vma_iterator *vmi,
_
Patches currently in -mm which might be from [email protected] are
maintainers-update-mglru-entry-to-reflect-current-status.patch selftests-mm-add-merge-test-for-partial-msealed-range.patch