Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754465AbbFEMiY (ORCPT ); Fri, 5 Jun 2015 08:38:24 -0400 Received: from www.linutronix.de ([62.245.132.108]:35303 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750860AbbFEMiX (ORCPT ); Fri, 5 Jun 2015 08:38:23 -0400 Date: Fri, 5 Jun 2015 14:38:16 +0200 (CEST) From: Thomas Gleixner To: Davidlohr Bueso cc: Peter Zijlstra , Ingo Molnar , Steven Rostedt , Mike Galbraith , "Paul E. McKenney" , Sebastian Andrzej Siewior , linux-kernel@vger.kernel.org, Davidlohr Bueso Subject: Re: [PATCH 2/4] locking/rtmutex: Use cmp-cmpxchg In-Reply-To: <1432056298-18738-3-git-send-email-dave@stgolabs.net> Message-ID: References: <1432056298-18738-1-git-send-email-dave@stgolabs.net> <1432056298-18738-3-git-send-email-dave@stgolabs.net> User-Agent: Alpine 2.11 (DEB 23 2013-08-11) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1047 Lines: 32 On Tue, 19 May 2015, Davidlohr Bueso wrote: > 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) Errm. How does that improve stuff like rt_mutex_lock() ? Thanks, tglx -- 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/