On Fri, 07 Oct 2016, Peter Zijlstra wrote:
+ * Optimistic trylock that only works in the uncontended case. Make sure to
+ * follow with a __mutex_trylock() before failing.
+ */
+static __always_inline bool __mutex_trylock_fast(struct mutex *lock)
+       unsigned long curr = (unsigned long)current;
+       if (!atomic_long_cmpxchg_acquire(&lock->owner, 0UL, curr))
+               return true;

Do we want to do a ccas check for !lock->owner? Although I can see a possible
case of 'optimizing for the contended' reasons for nay.


Reply via email to