Skip to contentSkip to conversation

tools-testing-vma-add-unit-tests-flag-empty-diff_pair-and.patch removed from -mm tree

merged mm-stable Andrew Morton 1 participant 1 message Mar 31

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: tools/testing/vma: add unit tests flag empty, diff_pair, and[_mask]
has been removed from the -mm tree. Its filename was
tools-testing-vma-add-unit-tests-flag-empty-diff_pair-and.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: tools/testing/vma: add unit tests flag empty, diff_pair, and[_mask]
Date: Fri, 20 Mar 2026 19:38:19 +0000

Add VMA unit tests to assert that:

* vma_flags_empty()
* vma_flags_diff_pair()
* vma_flags_and_mask()
* vma_flags_and()

All function as expected.

In additional to the added tests, in order to make testing easier, add vma_flags_same_mask() and vma_flags_same() for testing only. If/when these are required in kernel code, they can be moved over.

Also add ASSERT_FLAGS_[NOT_]SAME[_MASK](), ASSERT_FLAGS_[NON]EMPTY() test helpers to make asserting flag state easier and more convenient.

Cc Albert Ou <[email protected]>
Cc Alexander Gordeev <[email protected]>
Cc Alexandre Ghiti <[email protected]>
Cc Al Viro <[email protected]>
Cc Anton Ivanov <[email protected]>
Cc "Borislav Petkov (AMD)" <[email protected]>
Cc Catalin Marinas <[email protected]>
Cc Chengming Zhou <[email protected]>
Cc Christian Borntraeger <[email protected]>
Cc Christian Brauner <[email protected]>
Cc David Hildenbrand <[email protected]>
Cc Dinh Nguyen <[email protected]>
Cc Heiko Carstens <[email protected]>
Cc "H. Peter Anvin" <[email protected]>
Cc Huacai Chen <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Jan Kara <[email protected]>
Cc Jann Horn <[email protected]>
Cc Johannes Berg <[email protected]>
Cc Kees Cook <[email protected]>
Cc Liam Howlett <[email protected]>
Cc Madhavan Srinivasan <[email protected]>
Cc Michael Ellerman <[email protected]>
Cc Michal Hocko <[email protected]>
Cc Mike Rapoport <[email protected]>
Cc Nicholas Piggin <[email protected]>
Cc Ondrej Mosnacek <[email protected]>
Cc Palmer Dabbelt <[email protected]>
Cc Paul Moore <[email protected]>
Cc Pedro Falcato <[email protected]>
Cc Richard Weinberger <[email protected]>
Cc Russell King <[email protected]>
Cc Stephen Smalley <[email protected]>
Cc Suren Baghdasaryan <[email protected]>
Cc Sven Schnelle <[email protected]>
Cc Thomas Bogendoerfer <[email protected]>
Cc Vasily Gorbik <[email protected]>
Cc Vineet Gupta <[email protected]>
Cc Vlastimil Babka (SUSE) <[email protected]>
Cc WANG Xuerui <[email protected]>
Cc Will Deacon <[email protected]>
Cc xu xin <[email protected]>

---

 tools/testing/vma/include/custom.h |   12 ++
 tools/testing/vma/shared.h         |   18 +++
 tools/testing/vma/tests/vma.c      |  137 +++++++++++++++++++++++++++
 3 files changed, 167 insertions(+)
tools/testing/vma/include/custom.h renamed from tools/testing/vma/include/custom.h~tools-testing-vma-add-unit-tests-flag-empty-diff_pair-and +12 -0
@@ -120,3 +120,15 @@ static inline unsigned long vma_kernel_p
 {
 	return PAGE_SIZE;
 }
+
+/* Place here until needed in the kernel code. */
+static __always_inline bool vma_flags_same_mask(vma_flags_t *flags,
+						vma_flags_t flags_other)
+{
+	const unsigned long *bitmap = flags->__vma_flags;
+	const unsigned long *bitmap_other = flags_other.__vma_flags;
+
+	return bitmap_equal(bitmap, bitmap_other, NUM_VMA_FLAG_BITS);
+}
+#define vma_flags_same(flags, ...) \
+	vma_flags_same_mask(flags, mk_vma_flags(__VA_ARGS__))
tools/testing/vma/shared.h renamed from tools/testing/vma/shared.h~tools-testing-vma-add-unit-tests-flag-empty-diff_pair-and +18 -0
@@ -35,6 +35,24 @@
 #define ASSERT_EQ(_val1, _val2) ASSERT_TRUE((_val1) == (_val2))
 #define ASSERT_NE(_val1, _val2) ASSERT_TRUE((_val1) != (_val2))
 
+#define ASSERT_FLAGS_SAME_MASK(_flags, _flags_other) \
+	ASSERT_TRUE(vma_flags_same_mask((_flags), (_flags_other)))
+
+#define ASSERT_FLAGS_NOT_SAME_MASK(_flags, _flags_other) \
+	ASSERT_FALSE(vma_flags_same_mask((_flags), (_flags_other)))
+
+#define ASSERT_FLAGS_SAME(_flags, ...) \
+	ASSERT_TRUE(vma_flags_same(_flags, __VA_ARGS__))
+
+#define ASSERT_FLAGS_NOT_SAME(_flags, ...) \
+	ASSERT_FALSE(vma_flags_same(_flags, __VA_ARGS__))
+
+#define ASSERT_FLAGS_EMPTY(_flags) \
+	ASSERT_TRUE(vma_flags_empty(_flags))
+
+#define ASSERT_FLAGS_NONEMPTY(_flags) \
+	ASSERT_FALSE(vma_flags_empty(_flags))
+
 #define IS_SET(_val, _flags) ((_val & _flags) == _flags)
 
 extern bool fail_prealloc;
tools/testing/vma/tests/vma.c renamed from tools/testing/vma/tests/vma.c~tools-testing-vma-add-unit-tests-flag-empty-diff_pair-and +137 -0

147 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