[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200717175138.GB1156312@rowland.harvard.edu>
Date: Fri, 17 Jul 2020 13:51:38 -0400
From: Alan Stern <stern@...land.harvard.edu>
To: Matthew Wilcox <willy@...radead.org>
Cc: Eric Biggers <ebiggers@...nel.org>, linux-kernel@...r.kernel.org,
linux-arch@...r.kernel.org,
"Paul E . McKenney" <paulmck@...nel.org>,
linux-fsdevel@...r.kernel.org, Akira Yokosawa <akiyks@...il.com>,
Andrea Parri <parri.andrea@...il.com>,
Boqun Feng <boqun.feng@...il.com>,
Daniel Lustig <dlustig@...dia.com>,
"Darrick J . Wong" <darrick.wong@...cle.com>,
Dave Chinner <david@...morbit.com>,
David Howells <dhowells@...hat.com>,
Jade Alglave <j.alglave@....ac.uk>,
Luc Maranget <luc.maranget@...ia.fr>,
Nicholas Piggin <npiggin@...il.com>,
Peter Zijlstra <peterz@...radead.org>,
Will Deacon <will@...nel.org>
Subject: Re: [PATCH] tools/memory-model: document the "one-time init" pattern
On Fri, Jul 17, 2020 at 06:47:50PM +0100, Matthew Wilcox wrote:
> On Thu, Jul 16, 2020 at 09:44:27PM -0700, Eric Biggers wrote:
...
> > + /* on success, pairs with smp_load_acquire() above and below */
> > + if (cmpxchg_release(&foo, NULL, p) != NULL) {
>
> Why do we have cmpxchg_release() anyway? Under what circumstances is
> cmpxchg() useful _without_ having release semantics?
To answer just the last question: cmpxchg() is useful for lock
acquisition, in which case it needs to have acquire semantics rather
than release semantics.
Alan Stern
Powered by blists - more mailing lists