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 v2] selftests/mm: scale uffd memory region contingent upon base page size
Date: Thu, 5 Nov 2026 10:54:07 -0700 [thread overview]
Message-ID: <20261105175407.638242-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 made some basic revisions, but as I am looking to gauge opinions on
this email chain I am replying to the chain, I apologize if this is an
inconvenience.
Changes in v2:
* Since psize() is included from vm_util.h through uffd-common.h,
PAGE_SIZE macro removed.
* Added UL suffix to ensure integer is treated as unsigned long.
tools/testing/selftests/mm/uffd-unit-tests.c | 9 +++++++--
1 file changed, 7 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..3be227ed8d413f6e67e475862aba10ce13221446 100644
--- a/tools/testing/selftests/mm/uffd-unit-tests.c
+++ b/tools/testing/selftests/mm/uffd-unit-tests.c
@@ -13,8 +13,13 @@
#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 UFFD_TEST_MEM_SIZE (psize() * (16UL << 10))
#define MEM_ANON BIT_ULL(0)
#define MEM_SHMEM BIT_ULL(1)
--
2.56.0
prev parent reply other threads:[~2026-11-05 17:54 UTC|newest]
Thread overview: 11+ 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 ` [PATCH] selftests/mm: scale uffd memory region contingent upon base page size John J. Coleman
2026-11-05 17:54 ` 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=20261105175407.638242-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®