From: Peter Xu <peterx@redhat.com>
To: James Houghton <jthoughton@google.com>
Cc: Axel Rasmussen <axelrasmussen@google.com>,
Andrew Morton <akpm@linux-foundation.org>,
Muchun Song <songmuchun@bytedance.com>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] mm: Add an explicit smp_wmb() to UFFDIO_CONTINUE
Date: Thu, 7 Mar 2024 09:20:32 +0800 [thread overview]
Message-ID: <ZekWYNPDAwD12EWt@x1n> (raw)
In-Reply-To: <20240307010250.3847179-1-jthoughton@google.com>
On Thu, Mar 07, 2024 at 01:02:50AM +0000, James Houghton wrote:
> Users of UFFDIO_CONTINUE may reasonably assume that a write memory
> barrier is included as part of UFFDIO_CONTINUE. That is, a user may
> believe that all writes it has done to a page that it is now
> UFFDIO_CONTINUE'ing are guaranteed to be visible to anyone subsequently
> reading the page through the newly mapped virtual memory region.
>
> Today, such a user happens to be correct. mmget_not_zero(), for example,
> is called as part of UFFDIO_CONTINUE (and comes before any PTE updates),
> and it implicitly gives us a write barrier.
>
> To be resilient against future changes, include an explicit smp_wmb().
> While we're at it, optimize the smp_wmb() that is already incidentally
> present for the HugeTLB case.
>
> Merely making a syscall does not generally imply the memory ordering
> constraints that we need (including on x86).
>
> Signed-off-by: James Houghton <jthoughton@google.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
--
Peter Xu
prev parent reply other threads:[~2024-03-07 1:20 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-07 1:02 [PATCH v2] mm: Add an explicit smp_wmb() to UFFDIO_CONTINUE James Houghton
2024-03-07 1:20 ` Peter Xu [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=ZekWYNPDAwD12EWt@x1n \
--to=peterx@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=axelrasmussen@google.com \
--cc=jthoughton@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=songmuchun@bytedance.com \
/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;
as well as URLs for NNTP newsgroup(s).