lkml.org 
[lkml]   [2016]   [Oct]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH -v4 2/8] locking/mutex: Rework mutex::owner
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.

Thanks,
Davidlohr

\
 
 \ /
  Last update: 2016-10-12 20:35    [W:0.518 / U:0.028 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site