lkml.org 
[lkml]   [2018]   [Feb]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] tools/memory-model: remove rb-dep, smp_read_barrier_depends, and lockless_dereference
On Mon, Feb 19, 2018 at 06:44:13PM +0100, Peter Zijlstra wrote:
> On Mon, Feb 19, 2018 at 12:14:45PM -0500, Alan Stern wrote:
> > Note that operations like atomic_add_unless() already include memory
> > barriers.
>
> It is valid for atomic_add_unless() to not imply any barriers when the
> addition doesn't happen.

Agreed, given that atomic_add_unless() just returns 0 or 1, not the
pointer being added. Of course, the __atomic_add_unless() function
that it calls is another story, as it does return the old value. Sigh.
And __atomic_add_unless() is called directly from some code. All of
which looks to be counters rather than pointers, thankfully.

So, do we want to rely on atomic_add_unless() always being
invoked on counters rather than pointers, or does it need an
smp_read_barrier_depends()?

Thanx, Paul

\
 
 \ /
  Last update: 2018-02-20 15:48    [W:0.257 / U:0.056 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site