From: Peter Xu <peterx@redhat.com>
To: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
Andrew Morton <akpm@linux-foundation.org>,
linux-kernel@vger.kernel.org,
Matthew Wilcox <willy@infradead.org>,
Olivier Dion <odion@efficios.com>,
linux-mm@kvack.org
Subject: Re: [RFC PATCH 0/2] SKSM: Synchronous Kernel Samepage Merging
Date: Mon, 3 Mar 2025 10:01:58 -0500 [thread overview]
Message-ID: <Z8XEZsZ2LZfqwfhu@x1.local> (raw)
In-Reply-To: <e14516c2-bd7c-4bf1-b2af-314d23d8f59a@efficios.com>
On Sat, Mar 01, 2025 at 10:44:22AM -0500, Mathieu Desnoyers wrote:
> > > Also, I notice that do_wp_page() only calls handle_userfault
> > > VM_UFFD_WP when vm_fault flags does not have FAULT_FLAG_UNSHARE
> > > set.
> >
> > AFAICT that's expected, unshare should only be set on reads, never writes.
> > So uffd-wp shouldn't trap any of those.
>
> I'm confused by your comment. I thought unshare only applies to
> *write* faults. What am I missing ?
The major path so far to set unshare is here in GUP (ignoring two corner
cases used in either s390 and ksm):
if (unshare) {
fault_flags |= FAULT_FLAG_UNSHARE;
/* FAULT_FLAG_WRITE and FAULT_FLAG_UNSHARE are incompatible */
VM_BUG_ON(fault_flags & FAULT_FLAG_WRITE);
}
See the VM_BUG_ON() - if it's write it'll crash already.
"unshare", in its earliest form of patch, used to be called COR
(Copy-On-Read), which might be more straightforward in this case.. so it's
the counterpart of COW but for read cases where a copy is required. The
patchset that introduced it has more information (e.g. a7f2266041).
Thanks,
--
Peter Xu
next prev parent reply other threads:[~2025-03-03 15:02 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-28 2:30 Mathieu Desnoyers
2025-02-28 2:30 ` [RFC PATCH 1/2] mm: Introduce " Mathieu Desnoyers
2025-02-28 2:30 ` [RFC PATCH 2/2] selftests/kskm: Introduce SKSM basic test Mathieu Desnoyers
2025-02-28 2:51 ` [RFC PATCH 0/2] SKSM: Synchronous Kernel Samepage Merging Linus Torvalds
2025-02-28 3:03 ` Mathieu Desnoyers
2025-02-28 5:17 ` Linus Torvalds
2025-02-28 13:59 ` David Hildenbrand
2025-02-28 14:59 ` Sean Christopherson
2025-02-28 15:10 ` David Hildenbrand
2025-02-28 15:19 ` David Hildenbrand
2025-02-28 21:38 ` Mathieu Desnoyers
2025-02-28 21:45 ` David Hildenbrand
2025-02-28 21:49 ` Mathieu Desnoyers
2025-02-28 15:01 ` Mathieu Desnoyers
2025-02-28 15:18 ` David Hildenbrand
2025-02-28 14:59 ` Mathieu Desnoyers
2025-02-28 16:32 ` Peter Xu
2025-02-28 17:53 ` Mathieu Desnoyers
2025-02-28 22:32 ` Peter Xu
2025-03-01 15:44 ` Mathieu Desnoyers
2025-03-03 15:01 ` Peter Xu [this message]
2025-03-03 16:36 ` David Hildenbrand
2025-03-03 20:01 ` Mathieu Desnoyers
2025-03-03 20:45 ` Peter Xu
2025-03-03 20:49 ` David Hildenbrand
2025-03-05 14:06 ` Mathieu Desnoyers
2025-03-05 19:22 ` David Hildenbrand
2025-02-28 15:34 ` David Hildenbrand
2025-02-28 15:38 ` Matthew Wilcox
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=Z8XEZsZ2LZfqwfhu@x1.local \
--to=peterx@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=odion@efficios.com \
--cc=torvalds@linux-foundation.org \
--cc=willy@infradead.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox