[PATCH 1/2] Add a fast path for C rd/wrlock

Ondřej Bílka neleai@seznam.cz
Mon Mar 24 08:33:00 GMT 2014


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.



More information about the Libc-alpha mailing list