On 06/26/2013 09:06 PM, Andi Kleen wrote:In the uncontended case, doing spin_unlock_wait will be similar toI'm totally against any new users of spin_unlock_wait()
spin_can_lock. This, when combined with a cmpxchg, is still faster
than doing 2 atomic operations in spin_lock/spin_unlock.
It has bizarre semantics, most likely will make various
lock optimizations impossible, it's race condition hell
for most users etc.
spin_can_lock() is not quite as bad has a lot of the similar problems.
BTW, spin_can_lock is just the negation of spin_is_locked.e.g. with elision it's not.
-Andi
OK, it is about Haswell's lock elision feature. I will see what I can do to remove those problematic function calls.