This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH 1/2] Add a fast path for C rd/wrlock
- From: OndÅej BÃlka <neleai at seznam dot cz>
- To: Andi Kleen <andi at firstfloor dot org>
- Cc: libc-alpha at sourceware dot org, Andi Kleen <ak at linux dot intel dot com>
- Date: Mon, 24 Mar 2014 09:33:43 +0100
- Subject: Re: [PATCH 1/2] Add a fast path for C rd/wrlock
- Authentication-results: sourceware.org; auth=none
- References: <1395100891-22307-1-git-send-email-andi at firstfloor dot org>
On Mon, Mar 17, 2014 at 05:01:30PM -0700, Andi Kleen wrote:
> From: Andi Kleen <ak@linux.intel.com>
>
> One difference of the C versions to the assembler wr/rdlock
> is that the C compiler saves some registers which are unnecessary
> for the fast path in the prologue of the functions. Split the
> uncontended fast path out into a separate function. Only when contention is
> detected is the full featured function called. This makes
> the fast path code (nearly) identical to the assembler version,
> and gives uncontended performance within a few cycles.
>
Refactoring looks ok.
> nptl/:
> 2014-03-17 Andi Kleen <ak@linux.intel.com>
>
> * pthread_rwlock_rdlock (__pthread_rwlock_rdlock):
> Split into __do_pthread_rwlock_rdlock and __pthread_rwlock_rdlock.
> * pthread_rwlock_wrlock (__pthread_rwlock_wrlock):
> Split into __do_pthread_rwlock_wrlock and __pthread_wrlock_rdlock.
Needs to be changed to
* pthread_rwlock_rdlock.c (__pthread_rwlock_rdlock):
Split into __do_pthread_rwlock_rdlock and __pthread_rwlock_rdlock.
* pthread_rwlock_wrlock (__pthread_rwlock_wrlock):
Split into __do_pthread_rwlock_wrlock and __pthread_wrlock_rdlock.