lkml.org 
[lkml]   [2016]   [Mar]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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

\
 
 \ /
  Last update: 2016-03-02 18:21    [W:0.071 / U:1.064 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site