This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCHv3] powerpc: Fix write-after-destroy in lock elision
On Mon, 2017-01-02 at 16:15 -0200, Adhemerval Zanella wrote:
>
> On 02/01/2017 15:39, Torvald Riegel wrote:
> > It uses the lock, so can be concurrent with other accesses (that use
> > atomics). Thus, it must use atomics too to prevent data races.
>
> Indeed, we need to use atomic decrement on this one as well. I am not
> sure if is needed to use a stronger semantic than relaxed.
adapt_count is just a hint, as is explained in the comments in the
similar patch I had sent for x86. Given that it's just a hint, lost
updates are harmless for correctness, and the decrement does not need to
be atomic. The invididual loads and stores of a decrement should be
though, to avoid data races.