]> git.ipfire.org Git - thirdparty/glibc.git/commit
S390: Optimize lock-elision by decrementing adapt_count at unlock.
authorStefan Liebler <stli@linux.vnet.ibm.com>
Tue, 20 Dec 2016 14:12:48 +0000 (15:12 +0100)
committerStefan Liebler <stli@linux.vnet.ibm.com>
Tue, 20 Dec 2016 14:12:48 +0000 (15:12 +0100)
commitdd037fb3df286b7c2d0b0c6f8d02a2dd8a8e8a08
tree6a2cf84e658ddd3271b2a93c61c83aac4070e1d0
parent53c5c3d5ac238901c13f28a73ba05b0678094e80
S390: Optimize lock-elision by decrementing adapt_count at unlock.

This patch decrements the adapt_count while unlocking the futex
instead of before aquiring the futex as it is done on power, too.
Furthermore a transaction is only started if the futex is currently free.
This check is done after starting the transaction, too.
If the futex is not free and the transaction nesting depth is one,
we can simply end the started transaction instead of aborting it.
The implementation of this check was faulty as it always ended the
started transaction.  By using the fallback path, the the outermost
transaction was aborted.  Now the outermost transaction is aborted
directly.

This patch also adds some commentary and aligns the code in
elision-trylock.c to the code in elision-lock.c as possible.

ChangeLog:

* sysdeps/unix/sysv/linux/s390/lowlevellock.h
(__lll_unlock_elision, lll_unlock_elision): Add adapt_count argument.
* sysdeps/unix/sysv/linux/s390/elision-lock.c:
(__lll_lock_elision): Decrement adapt_count while unlocking
instead of before locking.
* sysdeps/unix/sysv/linux/s390/elision-trylock.c
(__lll_trylock_elision): Likewise.
* sysdeps/unix/sysv/linux/s390/elision-unlock.c:
(__lll_unlock_elision): Likewise.
ChangeLog
sysdeps/unix/sysv/linux/s390/elision-lock.c
sysdeps/unix/sysv/linux/s390/elision-trylock.c
sysdeps/unix/sysv/linux/s390/elision-unlock.c
sysdeps/unix/sysv/linux/s390/lowlevellock.h