This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCHv2 2/2] powerpc: Optimize lock elision for pthread_mutex_t
- From: Andreas Schwab <schwab at linux-m68k dot org>
- To: "Paul E. Murphy" <murphyp at linux dot vnet dot ibm dot com>
- Cc: "libc-alpha\ at sourceware dot org" <libc-alpha at sourceware dot org>, Adhemerval Zanella <adhemerval dot zanella at linaro dot org>
- Date: Thu, 03 Sep 2015 18:48:20 +0200
- Subject: Re: [PATCHv2 2/2] powerpc: Optimize lock elision for pthread_mutex_t
- Authentication-results: sourceware.org; auth=none
- References: <55E86D9A dot 6000902 at linux dot vnet dot ibm dot com>
"Paul E. Murphy" <murphyp@linux.vnet.ibm.com> writes:
> diff --git a/sysdeps/unix/sysv/linux/powerpc/elision-unlock.c b/sysdeps/unix/sysv/linux/powerpc/elision-unlock.c
> index f04c339..4307d44 100644
> --- a/sysdeps/unix/sysv/linux/powerpc/elision-unlock.c
> +++ b/sysdeps/unix/sysv/linux/powerpc/elision-unlock.c
> @@ -21,12 +21,20 @@
> #include "htm.h"
>
> int
> -__lll_unlock_elision(int *lock, int pshared)
> +__lll_unlock_elision(int *lock, short *adapt_count, int pshared)
> {
> /* When the lock was free we're in a transaction. */
> if (*lock == 0)
> __builtin_tend (0);
> else
> + {
> lll_unlock ((*lock), pshared);
> +
> + /* Update the adapt count AFTER completing the critical section.
> + Doing this here prevents unneeded stalling when entering
> + a critical section. Saving about 8% runtime on P8. */
> + if (*adapt_count > 0)
> + (*adapt_count)--;
> + }
Wrong indentation.
Andreas.
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."