Re: [PATCH v3 1/2] mm/khugepaged: Never install PMDs in uffd-minor-registered VMAs

From: James Houghton

Date: Thu Sep 10 2026 - 20:24:43 EST


On Thu, Sep 10, 2026 at 4:24 PM Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> wrote:
> Sashiko had a stupid niggle about the selftest change and made quite
> disturbing claims about the existing try_collapse_pte_mapped_thp() code:
>
> https://sashiko.dev/#/patchset/20260910023411.514987-1-jthoughton@xxxxxxxxxx

Thanks, it looks like the note it wrote about the selftest is genuine; it is
okay for MADV_COLLAPSE to fail. So I shouldn't have changed uffd_test_skip() to
uffd_test_fail().

Andrew, if you can, please add this diff as part of the patch to queue. (It's
a partial revert.) Or I could send the a new version of the patch as a reply
to patch #2 email. Or a whole v4, whatever's easiest.

diff --git a/tools/testing/selftests/mm/uffd-unit-tests.c b/tools/testing/selftests/mm/uffd-unit-tests.c
index 6f2360f9b75d..d8e40b770d88 100644
--- a/tools/testing/selftests/mm/uffd-unit-tests.c
+++ b/tools/testing/selftests/mm/uffd-unit-tests.c
@@ -639,7 +639,8 @@ static void uffd_minor_test_common(uffd_global_test_opts_t *gopts, bool test_col
/* MADV_COLLAPSE should succeed with userfaultfd unregistered. */
if (madvise(gopts->area_dst_alias, gopts->nr_pages * gopts->page_size,
MADV_COLLAPSE)) {
- uffd_test_fail("MADV_COLLAPSE failed");
+ /* It's fine to fail for this one... */
+ uffd_test_skip("MADV_COLLAPSE failed");
return;
}


With respect to the note about try_collapse_pte_mapped_thp() breaking POSIX
SIGBUS semantics, it definitely seems plausible. I'll look into it.

> I'll queue the series for test-n-review.

Thanks!