[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20160302164821.GB1092@dvhart-mobl5.amr.corp.intel.com>
Date: Wed, 2 Mar 2016 08:48:21 -0800
From: Darren Hart <dvhart@...radead.org>
To: Jianyu Zhan <nasa4836@...il.com>
Cc: linux-kernel@...r.kernel.org, paulmck@...ux.vnet.ibm.com,
peterz@...radead.org, tglx@...utronix.de, dave@...olabs.net,
akpm@...ux-foundation.org, mingo@...nel.org,
linux@...musvillemoes.dk, dvhart@...ux.intel.com,
bigeasy@...utronix.de, schwidefsky@...ibm.com,
heiko.carstens@...ibm.com
Subject: Re: [PATCH v2] futex: replace bare barrier() with a READ_ONCE()
On Wed, Mar 02, 2016 at 09:08:31PM +0800, Jianyu Zhan wrote:
...
> 3) READ_ONCE() _might_ prevent more _theoretical_ "optimizations" by the compiler:
>
> The above retry logic is effectively the same as:
>
> while (lock_ptr = READ_ONCE(q->lock_ptr)) {
> spin_lock(lock_ptr)
The spin_lock() is memory barrier, and therefor a general compiler barrier. The
READ_ONCE would be redundant in this case.
Unless you can demonstrate a failure mode in disassembly, or can point out how
the spin_lock barrier is insufficient that I have missed, this third point is
already covered.
--
Darren Hart
Intel Open Source Technology Center
Powered by blists - more mailing lists