This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [trans-mem] Add futex-based serial lock
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: Torvald Riegel <triegel at redhat dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>, Richard Henderson <rth at redhat dot com>
- Date: Sat, 20 Aug 2011 14:36:28 -0700
- Subject: Re: [trans-mem] Add futex-based serial lock
- References: <1313855517.3533.2476.camel@triegel.csb>
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.