From: Andrew Morton <akpm@linux-foundation.org>
To: mm-commits@vger.kernel.org,vbabka@kernel.org,surenb@google.com,
shuah@kernel.org,ryan.roberts@arm.com,rppt@kernel.org,peterx@redhat.com,
mhocko@suse.com,lokeshgidra@google.com,ljs@kernel.org,liam@infradead.org,
david@kernel.org,kaleshsingh@google.com,akpm@linux-foundation.org
Subject: + selftests-mm-uffd-wp-mremap-skip-unsupported-shmem-and-hugetlb-cases.patch added to mm-new branch
Date: Tue, 24 Nov 2026 15:34:04 -0800 [thread overview]
Message-ID: <20261124233405.103281F000CA@smtp.kernel.org> (raw)
In-Reply-To: <20261122082020.1255434-2-kaleshsingh@google.com>
The patch titled
Subject: selftests/mm: uffd-wp-mremap: skip unsupported shmem and hugetlb cases
has been added to the -mm mm-new branch. Its filename is
selftests-mm-uffd-wp-mremap-skip-unsupported-shmem-and-hugetlb-cases.patch
This patch will shortly appear at
https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/selftests-mm-uffd-wp-mremap-skip-unsupported-shmem-and-hugetlb-cases.patch
This patch will later appear in the mm-new branch at
git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Note, mm-new is a provisional staging ground for work-in-progress
patches, and acceptance into mm-new is a notification for others take
notice and to finish up reviews. Please do not hesitate to respond to
review feedback and post updated versions to replace or incrementally
fixup patches in mm-new.
The mm-new branch of mm.git is not included in linux-next
If a few days of testing in mm-new is successful, the patch will me moved
into mm.git's mm-unstable branch, which is included in linux-next
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a
reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next via various
branches at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there most days
------------------------------------------------------
From: Kalesh Singh <kaleshsingh@google.com>
Subject: selftests/mm: uffd-wp-mremap: skip unsupported shmem and hugetlb cases
Date: Sun, 22 Nov 2026 08:20:17 +0000
Patch series "selftests/mm: fix userfaultfd tests with
CONFIG_PTE_MARKER_UFFD_WP=n".
With CONFIG_PTE_MARKER_UFFD_WP=n, userfaultfd write protection only works
on anonymous memory. uffd-wp-mremap then fails its shmem and hugetlb
cases, and uffd-unit-tests skips anonymous runs that would pass. Patch 1
skips the unsupported uffd-wp-mremap cases and patch 2 filters
uffd-unit-tests' required features per memory type.
Tested on arm64 device: with CONFIG_PTE_MARKER_UFFD_WP=n,
uffd-wp-mremap goes from 26 failures to none and uffd-unit-tests
passes 78 tests instead of 70; with =y, the results are unchanged.
This patch (of 2):
uffd-wp-mremap checks only for UFFD_FEATURE_PAGEFAULT_FLAG_WP before it
runs. With CONFIG_PTE_MARKER_UFFD_WP=n the kernel keeps that feature
but supports write protection on anonymous memory only, so the shmem
and hugetlb cases fail with EINVAL from UFFDIO_REGISTER instead of
skipping. Skip them when UFFD_FEATURE_WP_HUGETLBFS_SHMEM is missing.
Link: https://lore.kernel.org/20261122082020.1255434-1-kaleshsingh@google.com
Link: https://patch.msgid.link/20261122082020.1255434-2-kaleshsingh@google.com
Fixes: b2466bb3b495 ("selftests/mm: introduce uffd-wp-mremap regression test")
Signed-off-by: Kalesh Singh <kaleshsingh@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Reviewed-by: Liam R. Howlett (Google) <liam@infradead.org>
Cc: Lokesh Gidra <lokeshgidra@google.com>
Cc: Mike Rapoport <rppt@kernel.org>
Cc: Peter Xu <peterx@redhat.com>
Cc: David Hildenbrand <david@kernel.org>
Cc: Lorenzo Stoakes <ljs@kernel.org>
Cc: Vlastimil Babka <vbabka@kernel.org>
Cc: Suren Baghdasaryan <surenb@google.com>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Shuah Khan <shuah@kernel.org>
Cc: Ryan Roberts <ryan.roberts@arm.com>
tools/testing/selftests/mm/uffd-wp-mremap.c | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
--- a/tools/testing/selftests/mm/uffd-wp-mremap.c~selftests-mm-uffd-wp-mremap-skip-unsupported-shmem-and-hugetlb-cases
+++ a/tools/testing/selftests/mm/uffd-wp-mremap.c
@@ -18,15 +18,14 @@ static int nr_thpsizes;
static unsigned long thpsizes[20];
static int nr_hugetlbsizes;
static unsigned long hugetlbsizes[10];
+static uint64_t uffd_features;
static void check_uffd_wp_feature_supported(void)
{
- uint64_t features = 0;
-
- if (uffd_get_features(&features))
+ if (uffd_get_features(&uffd_features))
ksft_exit_skip("failed to get available features (%d)\n", errno);
- if (!(features & UFFD_FEATURE_PAGEFAULT_FLAG_WP))
+ if (!(uffd_features & UFFD_FEATURE_PAGEFAULT_FLAG_WP))
ksft_exit_skip("uffd-wp feature not supported\n");
}
@@ -180,6 +179,12 @@ static void test_one_folio(uffd_global_t
swapout ? "true" : "false",
hugetlb ? "true" : "false");
+ if ((!private || hugetlb) &&
+ !(uffd_features & UFFD_FEATURE_WP_HUGETLBFS_SHMEM)) {
+ ksft_test_result_skip("uffd-wp on shmem and hugetlbfs is not supported\n");
+ return;
+ }
+
/* Allocate a folio of required size and type. */
mem = alloc_one_folio(size, private, hugetlb);
if (!mem) {
_
Patches currently in -mm which might be from kaleshsingh@google.com are
mm-swap-make-swap_header-badpages-a-flexible-array.patch
selftests-mm-uffd-wp-mremap-skip-unsupported-shmem-and-hugetlb-cases.patch
selftests-mm-uffd-unit-tests-filter-required-features-per-memory-type.patch
next prev parent reply other threads:[~2026-11-24 23:34 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-22 8:20 [PATCH 0/2] selftests/mm: fix userfaultfd tests with CONFIG_PTE_MARKER_UFFD_WP=n kaleshsingh
2026-11-22 8:20 ` [PATCH 1/2] selftests/mm: uffd-wp-mremap: skip unsupported shmem and hugetlb cases kaleshsingh
2026-11-24 14:13 ` Liam R. Howlett
2026-11-24 23:34 ` Andrew Morton [this message]
2026-11-22 8:20 ` [PATCH 2/2] selftests/mm: uffd-unit-tests: filter required features per memory type kaleshsingh
2026-11-24 14:14 ` Liam R. Howlett
2026-11-24 23:34 ` + selftests-mm-uffd-unit-tests-filter-required-features-per-memory-type.patch added to mm-new branch Andrew Morton
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=20261124233405.103281F000CA@smtp.kernel.org \
--to=akpm@linux-foundation.org \
--cc=david@kernel.org \
--cc=kaleshsingh@google.com \
--cc=liam@infradead.org \
--cc=ljs@kernel.org \
--cc=lokeshgidra@google.com \
--cc=mhocko@suse.com \
--cc=mm-commits@vger.kernel.org \
--cc=peterx@redhat.com \
--cc=rppt@kernel.org \
--cc=ryan.roberts@arm.com \
--cc=shuah@kernel.org \
--cc=surenb@google.com \
--cc=vbabka@kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.