mm-vma-introduce-vma_test-and-make-inlining-consistent.patch removed from -mm tree
The quilt patch titled
Subject: mm/vma: introduce vma_test[_any[_mask]](), and make inlining consistent
has been removed from the -mm tree. Its filename was
mm-vma-introduce-vma_test-and-make-inlining-consistent.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/vma: introduce vma_test[_any[_mask]](), and make inlining consistent
Date: Fri, 20 Mar 2026 19:38:30 +0000
Introduce helper functions and macros to make it convenient to test flags and flag masks for VMAs, specifically:
* vma_test() - determine if a single VMA flag is set in a VMA.
* vma_test_any_mask() - determine if any flags in a vma_flags_t value are set in a VMA.
* vma_test_any() - Helper macro to test if any of specific flags are set.
Also, there are a mix of 'inline's and '__always_inline's in VMA helper function declarations, update to consistently use __always_inline.
Finally, update the VMA tests to reflect the changes.
---
include/linux/mm.h | 49 +++++++++++++++++++----- include/linux/mm_types.h | 12 +++-- tools/testing/vma/include/dup.h | 61 +++++++++++++++++++----------- 3 files changed, 88 insertions(+), 34 deletions(-)
include/linux/mm.h renamed from include/linux/mm.h~mm-vma-introduce-vma_test-and-make-inlining-consistent +40 -9
@@ -994,7 +994,8 @@ static inline void vm_flags_mod(struct v__vm_flags_mod (vma, set, clear); } -static inline bool __vma_atomic_valid_flag (struct vm_area_struct *vma,vma_flag_t bit) +static __always_inline bool __vma_atomic_valid_flag(struct vm_area_struct *vma, +vma_flag_t bit) {const vm_flags_t mask =BIT ((__force int )bit);
@@ -1009,7 +1010,8 @@ static inline bool __vma_atomic_valid_fl* Set VMA flag atomically. Requires only VMA/mmap read lock. Only specific * valid flags are allowed to do this. */ -static inline void vma_set_atomic_flag (struct vm_area_struct *vma,vma_flag_t bit) +static __always_inline void vma_set_atomic_flag(struct vm_area_struct *vma, +vma_flag_t bit) {unsigned long *bitmap = vma->flags.__vma_flags;
@@ -1025,7 +1027,8 @@ static inline void vma_set_atomic_flag(s* This is necessarily racey, so callers must ensure that serialisation is * achieved through some other means, or that races are permissible. */ -static inline bool vma_test_atomic_flag (struct vm_area_struct *vma,vma_flag_t bit) +static __always_inline bool vma_test_atomic_flag(struct vm_area_struct *vma, +vma_flag_t bit) {if (__vma_atomic_valid_flag (vma, bit))return test_bit ((__force int )bit, &vma->vm_flags);
@@ -1231,12 +1234,40 @@ static __always_inline bool vma_flags_savma_flags_same_mask (flags,mk_vma_flags (__VA_ARGS__))/* +* Test whether a specific flag in the VMA is set, e.g.: +* +* if (vma_test(vma, VMA_READ_BIT)) { ... } + */ +static __always_inline bool vma_test(const struct vm_area_struct *vma, +vma_flag_t bit) +{ +return vma_flags_test (&vma->flags, bit); +} + +/* Helper to test any VMA flags in a VMA . */ +static __always_inline bool vma_test_any_mask(const struct vm_area_struct *vma, +vma_flags_t flags) +{ +return vma_flags_test_any_mask (&vma->flags, flags); +} + +/* +* Helper macro for testing whether any VMA flags are set in a VMA, +* e.g.: +* +* if (vma_test_any(vma, VMA_IO_BIT, VMA_PFNMAP_BIT, +* VMA_DONTEXPAND_BIT, VMA_DONTDUMP_BIT)) { ... } +*/ +#define vma_test_any (vma, ...) \ + vma_test_any_mask(vma, mk_vma_flags(__VA_ARGS__)) + +/* * Helper to test that ALL specified flags are set in a VMA. * * Note: appropriate locks must be held, this function does not acquire them for * you. */ -static inline bool vma_test_all_mask (const struct vm_area_struct *vma, +static __always_inline bool vma_test_all_mask(const struct vm_area_struct *vma,vma_flags_t flags) {return vma_flags_test_all_mask (&vma->flags, flags);
@@ -1256,7 +1287,7 @@ static inline bool vma_test_all_mask(con* Note: appropriate locks must be held, this function does not acquire them for * you. */ -static inline void vma_set_flags_mask (struct vm_area_struct *vma, +static __always_inline void vma_set_flags_mask(struct vm_area_struct *vma,vma_flags_t flags) {vma_flags_set_mask (&vma->flags, flags);
@@ -1286,7 +1317,7 @@ static __always_inline bool vma_desc_tes }/* Helper to test any VMA flags in a VMA descriptor. */ -static inline bool vma_desc_test_any_mask (const struct vm_area_desc *desc, +static __always_inline bool vma_desc_test_any_mask(const struct vm_area_desc *desc,vma_flags_t flags) {return vma_flags_test_any_mask (&desc->vma_flags, flags);
@@ -1303,7 +1334,7 @@ static inline bool vma_desc_test_any_masvma_desc_test_any_mask (desc,mk_vma_flags (__VA_ARGS__)) /* Helper to test all VMA flags in a VMA descriptor. */ -static inline bool vma_desc_test_all_mask (const struct vm_area_desc *desc, +static __always_inline bool vma_desc_test_all_mask(const struct vm_area_desc *desc,vma_flags_t flags) {return vma_flags_test_all_mask (&desc->vma_flags, flags);
@@ -1319,7 +1350,7 @@ static inline bool vma_desc_test_all_masvma_desc_test_all_mask (desc,mk_vma_flags (__VA_ARGS__)) /* Helper to set all VMA flags in a VMA descriptor. */ -static inline void vma_desc_set_flags_mask (struct vm_area_desc *desc, +static __always_inline void vma_desc_set_flags_mask(struct vm_area_desc *desc,vma_flags_t flags) {vma_flags_set_mask (&desc->vma_flags, flags);
@@ -1336,7 +1367,7 @@ static inline void vma_desc_set_flags_mavma_desc_set_flags_mask (desc,mk_vma_flags (__VA_ARGS__)) /* Helper to clear all VMA flags in a VMA descriptor. */ -static inline void vma_desc_clear_flags_mask (struct vm_area_desc *desc, +static __always_inline void vma_desc_clear_flags_mask(struct vm_area_desc *desc,vma_flags_t flags) {vma_flags_clear_mask (&desc->vma_flags, flags);
include/linux/mm_types.h renamed from include/linux/mm_types.h~mm-vma-introduce-vma_test-and-make-inlining-consistent +8 -4
@@ -1087,7 +1087,8 @@ static __always_inline vm_flags_t vma_fl* IMPORTANT: This does not overwrite bytes past the first system word. The * caller must account for this. */ -static inline void vma_flags_overwrite_word (vma_flags_t *flags,unsigned long value) +static __always_inline void vma_flags_overwrite_word(vma_flags_t *flags, +unsigned long value) {unsigned long *bitmap = flags->__vma_flags;
@@ -1114,7 +1115,8 @@ static __always_inline vma_flags_t legac* IMPORTANT: This does not overwrite bytes past the first system word. The * caller must account for this. */ -static inline void vma_flags_overwrite_word_once (vma_flags_t *flags,unsigned long value) +static __always_inline void vma_flags_overwrite_word_once(vma_flags_t *flags, +unsigned long value) {unsigned long *bitmap = flags->__vma_flags;
@@ -1122,7 +1124,8 @@ static inline void vma_flags_overwrite_w }/* Update the first system word of VMA flags setting bits, non-atomically. */ -static inline void vma_flags_set_word (vma_flags_t *flags,unsigned long value) +static __always_inline void vma_flags_set_word(vma_flags_t *flags, +unsigned long value) {unsigned long *bitmap = flags->__vma_flags;
@@ -1130,7 +1133,8 @@ static inline void vma_flags_set_word(vm }/* Update the first system word of VMA flags clearing bits, non-atomically. */ -static inline void vma_flags_clear_word (vma_flags_t *flags,unsigned long value) +static __always_inline void vma_flags_clear_word(vma_flags_t *flags, +unsigned long value) {unsigned long *bitmap = flags->__vma_flags;
tools/testing/vma/include/dup.h renamed from tools/testing/vma/include/dup.h~mm-vma-introduce-vma_test-and-make-inlining-consistent +40 -21
128 lines not on this page · raw message
_
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