From: Mohammed EL Kadiri <med08elkadiri@gmail.com>
To: lance.yang@linux.dev
Cc: david@kernel.org, samarth.colleges@gmail.com,
akpm@linux-foundation.org, xu.xin@linux.dev,
chengming.zhou@linux.dev, peterx@redhat.com, kas@kernel.org,
rppt@kernel.org, linux-mm@kvack.org,
linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH v2] mm/ksm: keep soft-dirty and uffd-wp when merging a page
Date: Tue, 20 Oct 2026 23:58:49 +0200 [thread overview]
Message-ID: <20261020215849.730615-1-med08elkadiri@gmail.com> (raw)
In-Reply-To: <20261020055518.36087-1-lance.yang@linux.dev>
This works for me, on b306deee4cba (mm-testing), x86_64,
CONFIG_KSM=y, CONFIG_USERFAULTFD=y, CONFIG_DEBUG_VM=y, KASAN enabled,
THP disabled.
Reproducer: merge 64 identical anon pages via KSM, arm synchronous
userfaultfd-wp on one page, then MADV_UNMERGEABLE it without touching
it. The page should come out private with WP semantics intact.
On the same commit, before applying your wp_page_copy()/handle_pte_fault()
fix:
UNMERGE ret=0 errno=0
AFTER_UNMERGE target_pfn=1153393 peer_pfn=1153393 target_KPF_KSM=1
FAIL: MADV_UNMERGEABLE returned success but target remains shared/KSM
and every run also hits this in dmesg:
FAULT_FLAG_ALLOW_RETRY missing c80
Call Trace:
handle_userfault.cold+0x30/0x3f
__handle_mm_fault+0xde9/0x1c30
handle_mm_fault+0x13b/0x440
break_ksm+0x8a/0x100
ksm_madvise+0x467/0x780
madvise_vma_behavior+0x1d1/0x1e40
madvise_do_behavior+0x431/0x14b0
do_madvise+0x162/0x210
break_ksm()'s internal fault-in to unshare the page is landing in the
uffd-wp fault handler, which isn't expecting it. 8/8 runs across two
boots, same trace every time.
After applying the fix:
AFTER_UNMERGE target_pfn=1063999 peer_pfn=1064929 target_KPF_KSM=0
PASS: target is private and no longer KSM-backed
FAULT event=18 flags=0x8 address=0x7f3dcb727000
PASS: read generated RWP fault and remained blocked
No warnings or call traces in dmesg. 8/8 runs across two boots.
Tested-by: Mohammed EL Kadiri <med08elkadiri@gmail.com>
prev parent reply other threads:[~2026-10-20 21:59 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-19 1:09 Samarth Narang
2026-10-19 2:07 ` Lance Yang
2026-10-19 13:24 ` David Hildenbrand (Arm)
2026-10-20 5:55 ` Lance Yang
2026-10-20 13:03 ` David Hildenbrand (Arm)
2026-10-20 13:29 ` Lance Yang
2026-10-21 8:21 ` David Hildenbrand (Arm)
2026-10-21 8:55 ` Kiryl Shutsemau
2026-10-21 9:49 ` Lance Yang
2026-10-20 21:58 ` Mohammed EL Kadiri [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=20261020215849.730615-1-med08elkadiri@gmail.com \
--to=med08elkadiri@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=chengming.zhou@linux.dev \
--cc=david@kernel.org \
--cc=kas@kernel.org \
--cc=lance.yang@linux.dev \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=peterx@redhat.com \
--cc=rppt@kernel.org \
--cc=samarth.colleges@gmail.com \
--cc=stable@vger.kernel.org \
--cc=xu.xin@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®