[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <ZekWYNPDAwD12EWt@x1n>
Date: Thu, 7 Mar 2024 09:20:32 +0800
From: Peter Xu <peterx@...hat.com>
To: James Houghton <jthoughton@...gle.com>
Cc: Axel Rasmussen <axelrasmussen@...gle.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Muchun Song <songmuchun@...edance.com>, linux-mm@...ck.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] mm: Add an explicit smp_wmb() to UFFDIO_CONTINUE
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@...gle.com>
Reviewed-by: Peter Xu <peterx@...hat.com>
--
Peter Xu
Powered by blists - more mailing lists