Skip to contentSkip to conversation

selftests-mm-uffd-unit-tests-support-for-hugepages-2m.patch removed from -mm tree

merged mm-stable Andrew Morton 1 participant 1 message Mar 22, 2025

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: selftests/mm: uffd-unit-tests support for hugepages > 2M
has been removed from the -mm tree. Its filename was
selftests-mm-uffd-unit-tests-support-for-hugepages-2m.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: Ryan Roberts <[email protected]>
Subject: selftests/mm: uffd-unit-tests support for hugepages > 2M
Date: Tue, 18 Mar 2025 17:43:40 +0000

uffd-unit-tests uses a memory area with a fixed 32M size. Then it calculates the number of pages by dividing by page_size, which itself is either the base page size or the PMD huge page size depending on the test config. For the latter, we end up with nr_pages=1 for arm64 16K base pages, and nr_pages=0 for 64K base pages. This doesn't end well.

So let's make the 32M size a floor and also ensure that we have at least 2 pages given the PMD size. With this change, the tests pass on arm64 64K base page size configuration.

---

 tools/testing/selftests/mm/uffd-unit-tests.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
tools/testing/selftests/mm/uffd-unit-tests.c renamed from tools/testing/selftests/mm/uffd-unit-tests.c~selftests-mm-uffd-unit-tests-support-for-hugepages-2m +4 -1
@@ -26,6 +26,8 @@
 #define ALIGN_UP(x, align_to) \
 	((__typeof__(x))((((unsigned long)(x)) + ((align_to)-1)) & ~((align_to)-1)))
 
+#define MAX(a, b) (((a) > (b)) ? (a) : (b))
+
 struct mem_type {
 	const char *name;
 	unsigned int mem_flag;
@@ -196,7 +198,8 @@ uffd_setup_environment(uffd_test_args_t
 	else
 		page_size = psize();
 
-	nr_pages = UFFD_TEST_MEM_SIZE / page_size;
+	/* Ensure we have at least 2 pages */
+	nr_pages = MAX(UFFD_TEST_MEM_SIZE, page_size * 2) / page_size;
 	/* TODO: remove this global var.. it's so ugly */
 	nr_parallel = 1;
 

_

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