[trans-mem] Add futex-based serial lock

H.J. Lu hjl.tools@gmail.com
Sat Aug 20 22:22:00 GMT 2011


On Sat, Aug 20, 2011 at 8:51 AM, Torvald Riegel <triegel@redhat.com> wrote:
> This adds a futex-based version of the serial lock for use on Linux. The
> futex code is basically old code of libitm (it got removed in SVN rev
> 157758) with one fix for sysfutex0 on x86_64 and one change that returns
> the number of woken processes (futex_wake).
>
> The gtm_rwlock is similar in concept to the mutex-based version, but
> adapted to futexes. It performs better than the mutex-based version. Not
> really great yet, but there is no spinning yet, so on contention we'll
> always have the overhead of waiting via the futexes.
>
> Again, RBTree with 1/2/4/6 threads, with different update %:
>  0%:  49    89   120   120
>  1%:  48    65    75    80
>  20%:  35    10    10     9
> 100%:  16.5   2.5   2.5   2.5
>
> For comparison, the mutex-based version:
> 0%:    49 / 90 / 120
> 1%:    47 / 59 /  27
> 20%    34 /  6 /   3
> 100%:  15 /  1 /   1
>
> OK for branch?
>

For x86. please use

#ifdef __x86_64__
# ifndef SYS_futex
#  define SYS_futex	202
# endif

so that it works with x32. See libgomp/config/linux/x86/futex.h

Thanks.

-- 
H.J.



More information about the Gcc-patches mailing list