lkml.org 
[lkml]   [2016]   [May]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2] locking/rwsem: Add reader-owned state to the owner field
On Wed, May 18, 2016 at 01:05:55PM +0200, Peter Zijlstra wrote:
> On Tue, May 17, 2016 at 12:46:07PM -0700, Paul E. McKenney wrote:
> > Actually, if you show a case where this makes a visible system-wide
> > difference, you could create a set of primitives for #1 below. Have
> > a compiler version check, and if it is an old compiler, map them to
> > READ_ONCE() and WRITE_ONCE(), otherwise as follows, though preferably
> > with better names:
> >
> > #define READ_NOTEAR(x) __atomic_load_n(&(x), __ATOMIC_RELAXED)
> > #define WRITE_NOTEAR(x, v) __atomic_store_n(&(x), (v), __ATOMIC_RELAXED)
> >
> > The ambiguity between "no tear" and "not ear" should help motivate a
> > better choice of name.
>
> Alternatively, could we try and talk to our GCC friends to make sure GCC
> doesn't tear loads/stores irrespective of what the C language spec
> allows?

Interestingly enough, they used to make that guarantee, but removed it
when C11 showed up.

Me, I would feel better explicitly telling the compiler what I needed.
It is all too easy for bugs to slip in otherwise, especially when the
gcc guys are adding exciting new optimizations.

Thanx, Paul

\
 
 \ /
  Last update: 2016-05-18 19:41    [W:0.092 / U:0.076 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site