From: "John J. Coleman" <jocolema@redhat.com>
To: zenghui.yu@linux.dev
Cc: akpm@linux-foundation.org, david@kernel.org, liam@infradead.org,
linux-kernel@vger.kernel.org, linux-mm@kvack.org, ljs@kernel.org,
mhocko@suse.com, peterx@redhat.com, rppt@kernel.org,
surenb@google.com, vbabka@kernel.org, audra@redhat.com
Subject: [PATCH] selftests/mm: scale uffd memory region contingent upon base page size
Date: Tue, 3 Nov 2026 13:20:49 -0700 [thread overview]
Message-ID: <20261103202049.499206-1-jocolema@redhat.com> (raw)
In-Reply-To: <20261011163527.95988-1-zenghui.yu@linux.dev>
When executing the uffd-unit-test, the "move-pmd on anon" test will fail on
aarch64+64k with a segmentation fault because the initial allocated memory
region is too small. This only happens with the move-pmd* tests because the
architecture base page size is still utilized even though the memory region is
specific to the size indicated by the pmd.
Patch 9f5c2aec3388 ("selftests/mm: fix uffd move-pmd test crash on 64K base page
systems") implements an initial fix to the segmentation fault by skipping the
test if the allocated memory region is not large enough for the number of pages
x page size requested. But as this will skip over the aarch64+64k pmd tests, this
patch is intended to resolve the problem with 64k pages by scaling up the
initial allocated memory region subject to base page size of the architecture.
Fixes: a2bf6a9ca805 ("selftests/mm: add UFFDIO_MOVE ioctl test")
Signed-off-by: John J. Coleman <jocolema@redhat.com>
---
I too have been looking into a solution for aarch64+64k. I wanted to gauge your
thoughts on this patch to scale up memory allocation region size predicated on
architecture base page sizes.
tools/testing/selftests/mm/uffd-unit-tests.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/tools/testing/selftests/mm/uffd-unit-tests.c b/tools/testing/selftests/mm/uffd-unit-tests.c
index 2a97ba1d6feb1b35d6281449fd1917793a64fab1..c6cebb3c880d0b47e44c8afc4e3a4c3050cea579 100644
--- a/tools/testing/selftests/mm/uffd-unit-tests.c
+++ b/tools/testing/selftests/mm/uffd-unit-tests.c
@@ -13,8 +13,14 @@
#ifdef __NR_userfaultfd
-/* The unit test doesn't need a large or random size, make it 32MB for now */
-#define UFFD_TEST_MEM_SIZE (32UL << 20)
+/*
+ * The unit test does not need a large or random size, but the allocation size
+ * needs to scale with base page size per architecture otherwise pmd alignment
+ * tests will fail for architectures like aarch64+64k. For standard 4k pages,
+ * this will allocate 64MiB, while allocating 1GiB for 64k page sizes.
+ */
+#define PAGE_SIZE sysconf(_SC_PAGESIZE)
+#define UFFD_TEST_MEM_SIZE (PAGE_SIZE * (16 << 10))
#define MEM_ANON BIT_ULL(0)
#define MEM_SHMEM BIT_ULL(1)
--
2.56.0
prev parent reply other threads:[~2026-11-03 20:21 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-11 16:35 [PATCH] selftests/mm: fix uffd move-pmd test crash on 64K base page systems Zenghui Yu
2026-10-12 6:13 ` Sarthak Sharma
2026-10-29 13:10 ` Zenghui Yu
2026-10-12 12:12 ` Jose A. Perez de Azpillaga
2026-10-13 7:39 ` David Hildenbrand (Arm)
2026-10-13 10:33 ` Mike Rapoport
2026-10-13 11:46 ` David Hildenbrand (Arm)
2026-10-29 13:37 ` Zenghui Yu
2026-10-29 15:47 ` David Hildenbrand (Arm)
2026-11-03 20:20 ` John J. Coleman [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261103202049.499206-1-jocolema@redhat.com \
--to=jocolema@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=audra@redhat.com \
--cc=david@kernel.org \
--cc=liam@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=ljs@kernel.org \
--cc=mhocko@suse.com \
--cc=peterx@redhat.com \
--cc=rppt@kernel.org \
--cc=surenb@google.com \
--cc=vbabka@kernel.org \
--cc=zenghui.yu@linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®