[PATCH][BZ #13065] New pthread_barrier algorithm to fulfill barrier destruction requirements.
Torvald Riegel
triegel@redhat.com
Fri Dec 18 16:42:00 GMT 2015
On Sun, 2015-07-19 at 23:52 +0200, Torvald Riegel wrote:
> The previous barrier implementation did not fulfill the POSIX
> requirements for when a barrier can be destroyed. Specifically, it was
> possible that threads that haven't noticed yet that their round is
> complete still access the barrier's memory, and that those accesses can
> happen after the barrier has been legally destroyed.
> The new algorithm does not have this issue, and it avoids using a lock
> internally.
>
> Tested on x86_64-linux.
>
> Dave, I haven't touched sparc yet, and applying this patch would break
> sparc I think because of the internaltypes.h change. What do you want
> to do? One option would be wait for the barrier to get ready for
> master, and then copy for sparc and adapt for sparc32.
>
> This is not meant for 2.22.
Ping. Attached is a rebased patch.
It would be nice to have this in 2.23.
2015-12-18 Torvald Riegel <triegel@redhat.com>
[BZ #13065]
* nptl/pthread_barrier_wait.c (__pthread_barrier_wait): Replace with
new implementation.
* nptl/pthread_barrier_destroy.c (pthread_barrier_destroy): Likewise.
* nptl/pthread_barrier_init.c (__pthread_barrier_init): Adapt.
* sysdeps/nptl/internaltypes.h (pthread_barrier): Adapt.
(BARRIER_IN_THRESHOLD): New macro.
* nptl/pthread_barrierattr_setpshared.c
(pthread_barrierattr_setpshared): Clean up.
* nptl/tst-barrier4.c: Correct comment.
* nptl/tst-barrier5.c: New file.
* nptl/Makefile (tests): Add nptl/tst-barrier5.c.
(gen-as-const-headers): Remove lowlevelbarrier.sym.
* sysdeps/unix/sysv/linux/i386/pthread_barrier_wait.S: Remove.
* sysdeps/unix/sysv/linux/x86_64/pthread_barrier_wait.S: Remove.
* nptl/lowlevelbarrier.sym: Remove.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: barrier.patch
Type: text/x-patch
Size: 32714 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20151218/6b21b6a8/attachment.bin>
More information about the Libc-alpha
mailing list