[PATCH][BZ #13065] New pthread_barrier algorithm to fulfill barrier destruction requirements.
Torvald Riegel
triegel@redhat.com
Sun Jul 19 21:52:00 GMT 2015
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.
Siddhesh, could please you put this into rawhide unless there are
objections brought up in the next week or so? (I'm still working on the
condvar update, so maybe wait until that is done.)
2015-07-19 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_init.c (pthread_barrierattr_init):
Clean up function definition.
* nptl/pthread_barrierattr_getpshared.c
(pthread_barrierattr_getpshared): Likewise.
* nptl/pthread_barrierattr_setpshared.c
(pthread_barrierattr_setpshared): Likewise.
* nptl/tst-barrier4.c: Correct comment.
* nptl/tst-barrier5.c: New file.
* nptl/Makefile (tests): Addnptl/tst-barrier5.c.
(gen-as-const-headers): Remove lowlevelbarrier.sym.
* sysdeps/unix/sysv/linux/i386/i486/pthread_barrier_wait.S: Remove.
* sysdeps/unix/sysv/linux/i386/i586/pthread_barrier_wait.S: Remove.
* sysdeps/unix/sysv/linux/i386/i686/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: 36537 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20150719/5c9f90d6/attachment.bin>
More information about the Libc-alpha
mailing list