x86: Improve spinlocks using ISO C++11 intrinsic atomics
Make some improvements to the x86 spinlock implementation using the ISO
C++11 intrinsic atomic wrappers. Note that since the spinlocks use
cmpxchg(), xadd() and __add(), it already makes some use of this.
(1) Use acquire variants in spin_lock() and spin_trylock() paths. On x86
this shouldn't actually make a difference.
(2) Use try_cmpxchg*() rather than cmpxchg*(). This should produce
slightly more efficient code as a comparison can be discarded in
favour of using the value in the Z flag.
Note as mentioned before, the LOCK prefix is currently mandatory, but a gcc
ticket is open to try and get these listed for suppression.
Signed-off-by: David Howells <dhowells@redhat.com>
2 files changed