Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754701AbbESRZZ (ORCPT ); Tue, 19 May 2015 13:25:25 -0400 Received: from smtp2.provo.novell.com ([137.65.250.81]:59701 "EHLO smtp2.provo.novell.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751494AbbESRZX (ORCPT ); Tue, 19 May 2015 13:25:23 -0400 From: Davidlohr Bueso To: Thomas Gleixner , Peter Zijlstra , Ingo Molnar Cc: Steven Rostedt , Mike Galbraith , "Paul E. McKenney" , Sebastian Andrzej Siewior , Davidlohr Bueso , linux-kernel@vger.kernel.org, Davidlohr Bueso Subject: [PATCH 2/4] locking/rtmutex: Use cmp-cmpxchg Date: Tue, 19 May 2015 10:24:56 -0700 Message-Id: <1432056298-18738-3-git-send-email-dave@stgolabs.net> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1432056298-18738-1-git-send-email-dave@stgolabs.net> References: <1432056298-18738-1-git-send-email-dave@stgolabs.net> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1031 Lines: 31 Avoid unnecessary cmpxchg calls, all of our other locks use it as well. Signed-off-by: Davidlohr Bueso --- kernel/locking/rtmutex.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/kernel/locking/rtmutex.c b/kernel/locking/rtmutex.c index 74188d8..1d5cc9d 100644 --- a/kernel/locking/rtmutex.c +++ b/kernel/locking/rtmutex.c @@ -74,7 +74,9 @@ static void fixup_rt_mutex_waiters(struct rt_mutex *lock) * set up. */ #ifndef CONFIG_DEBUG_RT_MUTEXES -# define rt_mutex_cmpxchg(l,c,n) (cmpxchg(&l->owner, c, n) == c) +# define rt_mutex_cmpxchg(l,c,n) \ + (l->owner == c && cmpxchg(&l->owner, c, n) == c) + static inline void mark_rt_mutex_waiters(struct rt_mutex *lock) { unsigned long owner, *p = (unsigned long *) &lock->owner; -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/