mm-always-inline-__mk_vma_flags-and-invoked-functions.patch removed from -mm tree
The quilt patch titled
Subject: mm: always inline __mk_vma_flags() and invoked functions
has been removed from the -mm tree. Its filename was
mm-always-inline-__mk_vma_flags-and-invoked-functions.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: always inline __mk_vma_flags() and invoked functions
Date: Thu, 5 Mar 2026 10:50:16 +0000
Be explicit about __mk_vma_flags() (which is used by the mk_vma_flags() macro) always being inline, as we rely on the compiler to evaluate the loop in this function and determine that it can replace the code with the an equivalent constant value, e.g. that:
__mk_vma_flags(2, (const vma_flag_t []){ VMA_WRITE_BIT, VMA_EXEC_BIT });
Can be replaced with:
(1UL << VMA_WRITE_BIT) | (1UL << VMA_EXEC_BIT)
= (1UL << 1) | (1UL << 2) = 6
Most likely an 'inline' will suffice for this, but be explicit as we can be.
Also update all of the functions __mk_vma_flags() ultimately invokes to be always inline too.
Note that test_bitmap_const_eval() asserts that the relevant bitmap functions result in build time constant values.
Additionally, vma_flag_set() operates on a vma_flags_t type, so it is inconsistently named versus other VMA flags functions.
We only use vma_flag_set() in __mk_vma_flags() so we don't need to worry about its new name being rather cumbersome, so rename it to vma_flags_set_flag() to disambiguate it from vma_flags_set().
Also update the VMA test headers to reflect the changes.
---
include/linux/mm.h | 8 +++++--- include/linux/mm_types.h | 2 +- tools/testing/vma/include/custom.h | 5 +++-- tools/testing/vma/include/dup.h | 5 +++-- 4 files changed, 12 insertions(+), 8 deletions(-)
include/linux/mm.h renamed from include/linux/mm.h~mm-always-inline-__mk_vma_flags-and-invoked-functions +5 -3
@@ -1030,21 +1030,23 @@ static inline bool vma_test_atomic_flag( }/* Set an individual VMA flag in flags, non-atomically. */ -static inline void vma_flag_set (vma_flags_t *flags,vma_flag_t bit) +static __always_inline void vma_flags_set_flag(vma_flags_t *flags, +vma_flag_t bit) {unsigned long *bitmap = flags->__vma_flags;__set_bit ((__force int )bit, bitmap); } -static inline vma_flags_t __mk_vma_flags (size_t count,const vma_flag_t *bits) +static __always_inline vma_flags_t __mk_vma_flags(size_t count, +const vma_flag_t *bits) {vma_flags_t flags;int i;vma_flags_clear_all (&flags);for (i =0 ; i < count; i++) -vma_flag_set (&flags, bits[i]); +vma_flags_set_flag (&flags, bits[i]);return flags; }
include/linux/mm_types.h renamed from include/linux/mm_types.h~mm-always-inline-__mk_vma_flags-and-invoked-functions +1 -1
@@ -1056,7 +1056,7 @@ struct vm_area_struct { } __randomize_layout;/* Clears all bits in the VMA flags bitmap, non-atomically. */ -static inline void vma_flags_clear_all (vma_flags_t *flags) +static __always_inline void vma_flags_clear_all(vma_flags_t *flags) {bitmap_zero (flags->__vma_flags,NUM_VMA_FLAG_BITS ); }
tools/testing/vma/include/custom.h renamed from tools/testing/vma/include/custom.h~mm-always-inline-__mk_vma_flags-and-invoked-functions +3 -2
@@ -102,7 +102,8 @@ static inline void vma_lock_init(structrefcount_set (&vma->vm_refcnt,0 ); } -static inline vma_flags_t __mk_vma_flags (size_t count,const vma_flag_t *bits) +static __always_inline vma_flags_t __mk_vma_flags(size_t count, +const vma_flag_t *bits) {vma_flags_t flags;int i;
@@ -114,6 +115,6 @@ static inline vma_flags_t __mk_vma_flagsvma_flags_clear_all (&flags);for (i =0 ; i < count; i++)if (bits[i] <NUM_VMA_FLAG_BITS ) -vma_flag_set (&flags, bits[i]); +vma_flags_set_flag (&flags, bits[i]);return flags; }
tools/testing/vma/include/dup.h renamed from tools/testing/vma/include/dup.h~mm-always-inline-__mk_vma_flags-and-invoked-functions +3 -2
@@ -780,12 +780,13 @@ static inline void vma_flags_clear_word( *bitmap &= ~value; } -static inline void vma_flags_clear_all (vma_flags_t *flags) +static __always_inline void vma_flags_clear_all(vma_flags_t *flags) {bitmap_zero (ACCESS_PRIVATE (flags, __vma_flags),NUM_VMA_FLAG_BITS ); } -static inline void vma_flag_set (vma_flags_t *flags,vma_flag_t bit) +static __always_inline void vma_flags_set_flag(vma_flags_t *flags, +vma_flag_t bit) {unsigned long *bitmap =ACCESS_PRIVATE (flags, __vma_flags);
_
Patches currently in -mm which might be from [email protected] are
mm-vma-add-vma_flags_empty-vma_flags_and-vma_flags_diff_pair.patch tools-testing-vma-add-unit-tests-flag-empty-diff_pair-and.patch mm-vma-add-further-vma_flags_t-unions.patch tools-testing-vma-convert-bulk-of-test-code-to-vma_flags_t.patch mm-vma-use-new-vma-flags-for-sticky-flags-logic.patch tools-testing-vma-fix-vma-flag-tests.patch mm-vma-add-append_vma_flags-helper.patch tools-testing-vma-add-simple-test-for-append_vma_flags.patch mm-unexport-vm_brk_flags-and-eliminate-vm_flags-parameter.patch mm-vma-introduce-vma_flags_same.patch mm-vma-introduce-_to_-helpers.patch tools-testing-vma-test-that-legacy-flag-helpers-work-correctly.patch mm-vma-introduce-vma_test-and-make-inlining-consistent.patch tools-testing-vma-update-vma-flag-tests-to-test-vma_test.patch mm-introduce-vma_flags_count-and-vma_test_single_mask.patch tools-testing-vma-test-vma_flags_countvma_test_single_mask.patch mm-convert-do_brk_flags-to-use-vma_flags_t.patch mm-update-vma_supports_mlock-to-use-new-vma-flags.patch mm-vma-introduce-vma_clear_flags.patch tools-testing-vma-update-vma-tests-to-test-vma_clear_flags.patch mm-vma-convert-as-much-as-we-can-in-mm-vmac-to-vma_flags_t.patch tools-bitmap-add-missing-bitmap_copy-implementation.patch mm-vma-convert-vma_modify_flags-to-use-vma_flags_t.patch mm-vma-convert-__mmap_region-to-use-vma_flags_t.patch mm-simplify-vma-flag-tests-of-excluded-flags.patch mm-various-small-mmap_prepare-cleanups.patch mm-add-documentation-for-the-mmap_prepare-file-operation-callback.patch mm-document-vm_operations_struct-open-the-same-as-close.patch mm-avoid-deadlock-when-holding-rmap-on-mmap_prepare-error.patch mm-switch-the-rmap-lock-held-option-off-in-compat-layer.patch mm-vma-remove-superfluous-map-hold_file_rmap_lock.patch mm-have-mmap_action_complete-handle-the-rmap-lock-and-unmap.patch mm-add-vm_ops-mapped-hook.patch fs-afs-revert-mmap_prepare-change.patch fs-afs-restore-mmap_prepare-implementation.patch mm-add-mmap_action_simple_ioremap.patch misc-open-dice-replace-deprecated-mmap-hook-with-mmap_prepare.patch hpet-replace-deprecated-mmap-hook-with-mmap_prepare.patch mtdchar-replace-deprecated-mmap-hook-with-mmap_prepare-clean-up.patch stm-replace-deprecated-mmap-hook-with-mmap_prepare.patch staging-vme_user-replace-deprecated-mmap-hook-with-mmap_prepare.patch mm-allow-handling-of-stacked-mmap_prepare-hooks-in-more-drivers.patch drivers-hv-vmbus-replace-deprecated-mmap-hook-with-mmap_prepare.patch uio-replace-deprecated-mmap-hook-with-mmap_prepare-in-uio_info.patch mm-add-mmap_action_map_kernel_pages.patch mm-on-remap-assert-that-input-range-within-the-proposed-vma.patch mm-huge_memory-simplify-vma_is_specal_huge.patch mm-huge-avoid-big-else-branch-in-zap_huge_pmd.patch mm-huge_memory-have-zap_huge_pmd-return-a-boolean-add-kdoc.patch mm-huge_memory-handle-buggy-pmd-entry-in-zap_huge_pmd.patch mm-huge_memory-add-a-common-exit-path-to-zap_huge_pmd.patch mm-huge_memory-remove-unnecessary-vm_bug_on_page.patch mm-huge_memory-deduplicate-zap-deposited-table-call.patch mm-huge_memory-remove-unnecessary-sanity-checks.patch mm-huge_memory-use-mm-instead-of-tlb-mm.patch mm-huge_memory-separate-out-the-folio-part-of-zap_huge_pmd.patch mm-add-softleaf_is_valid_pmd_entry-pmd_to_softleaf_folio.patch mm-huge_memory-add-and-use-normal_or_softleaf_folio_pmd.patch mm-huge_memory-add-and-use-has_deposited_pgtable.patch maintainers-update-mglru-entry-to-reflect-current-status.patch