Skip to contentSkip to conversation

tools-testing-vma-add-vma-userland-tests-for-vma-flag-functions.patch removed from -mm tree

merged mm-stable Andrew Morton 1 participant 1 message Feb 12

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: tools/testing/vma: add VMA userland tests for VMA flag functions
has been removed from the -mm tree. Its filename was
tools-testing-vma-add-vma-userland-tests-for-vma-flag-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 <[email protected]>
Subject: tools/testing/vma: add VMA userland tests for VMA flag functions
Date: Thu, 22 Jan 2026 16:06:22 +0000

Now we have the capability to test the new helpers for the bitmap VMA flags in userland, do so.

We also update the Makefile such that both VMA (and while we're here) mm_struct flag sizes can be customised on build. We default to 128-bit to enable testing of flags above word size even on 64-bit systems.

We add userland tests to ensure that we do not regress VMA flag behaviour with the introduction when using bitmap VMA flags, nor accidentally introduce unexpected results due to for instance higher bit values not being correctly cleared/set.

As part of this change, make __mk_vma_flags() a custom function so we can handle specifying invalid VMA bits. This is purposeful so we can have the VMA tests work at lower and higher number of VMA flags without having to duplicate code too much.

---

 tools/testing/vma/Makefile         |    3 
 tools/testing/vma/include/custom.h |   16 +
 tools/testing/vma/include/dup.h    |   11 
 tools/testing/vma/tests/vma.c      |  300 +++++++++++++++++++++++++++
 tools/testing/vma/vma_internal.h   |    4 
 5 files changed, 322 insertions(+), 12 deletions(-)
tools/testing/vma/include/custom.h renamed from tools/testing/vma/include/custom.h~tools-testing-vma-add-vma-userland-tests-for-vma-flag-functions +16 -0
@@ -101,3 +101,19 @@ static inline void vma_lock_init(struct
 	if (reset_refcnt)
 		refcount_set(&vma->vm_refcnt, 0);
 }
+
+static inline vma_flags_t __mk_vma_flags(size_t count, const vma_flag_t *bits)
+{
+	vma_flags_t flags;
+	int i;
+
+	/*
+	 * For testing purposes: allow invalid bit specification so we can
+	 * easily test.
+	 */
+	vma_flags_clear_all(&flags);
+	for (i = 0; i < count; i++)
+		if (bits[i] < NUM_VMA_FLAG_BITS)
+			vma_flag_set(&flags, bits[i]);
+	return flags;
+}
tools/testing/vma/include/dup.h renamed from tools/testing/vma/include/dup.h~tools-testing-vma-add-vma-userland-tests-for-vma-flag-functions +1 -10
@@ -838,16 +838,7 @@ static inline void vm_flags_clear(struct
 	vma_flags_clear_word(&vma->flags, flags);
 }
 
-static 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]);
-	return flags;
-}
+static inline vma_flags_t __mk_vma_flags(size_t count, const vma_flag_t *bits);
 
 #define mk_vma_flags(...) __mk_vma_flags(COUNT_ARGS(__VA_ARGS__), \
 					 (const vma_flag_t []){__VA_ARGS__})
tools/testing/vma/Makefile renamed from tools/testing/vma/Makefile~tools-testing-vma-add-vma-userland-tests-for-vma-flag-functions +3 -0
@@ -9,6 +9,9 @@ include ../shared/shared.mk
 OFILES = $(SHARED_OFILES) main.o shared.o maple-shim.o
 TARGETS = vma
 
+# These can be varied to test different sizes.
+CFLAGS += -DNUM_VMA_FLAG_BITS=128 -DNUM_MM_FLAG_BITS=128
+
 main.o: main.c shared.c shared.h vma_internal.h tests/merge.c tests/mmap.c tests/vma.c ../../../mm/vma.c ../../../mm/vma_init.c ../../../mm/vma_exec.c ../../../mm/vma.h include/custom.h include/dup.h include/stubs.h
 
 vma:	$(OFILES)
tools/testing/vma/tests/vma.c renamed from tools/testing/vma/tests/vma.c~tools-testing-vma-add-vma-userland-tests-for-vma-flag-functions +300 -0

312 lines not on this page · raw message

tools/testing/vma/vma_internal.h renamed from tools/testing/vma/vma_internal.h~tools-testing-vma-add-vma-userland-tests-for-vma-flag-functions +2 -2
@@ -36,11 +36,11 @@
  * ahead of all other headers.
  */
 #define __private
-#define NUM_MM_FLAG_BITS (64)
+/* NUM_MM_FLAG_BITS defined by test code. */
 typedef struct {
 	__private DECLARE_BITMAP(__mm_flags, NUM_MM_FLAG_BITS);
 } mm_flags_t;
-#define NUM_VMA_FLAG_BITS BITS_PER_LONG
+/* NUM_VMA_FLAG_BITS defined by test code. */
 typedef struct {
 	DECLARE_BITMAP(__vma_flags, NUM_VMA_FLAG_BITS);
 } __private vma_flags_t;

_

Patches currently in -mm which might be from [email protected] are