From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1423086AbcFGUWK (ORCPT ); Tue, 7 Jun 2016 16:22:10 -0400 Received: from bombadil.infradead.org ([198.137.202.9]:36663 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1161157AbcFGUTf (ORCPT ); Tue, 7 Jun 2016 16:19:35 -0400 Message-Id: <20160607200215.854135366@infradead.org> User-Agent: quilt/0.63-1 Date: Tue, 07 Jun 2016 21:56:39 +0200 From: Peter Zijlstra To: mingo@kernel.org, tglx@linutronix.de, juri.lelli@arm.com, rostedt@goodmis.org, xlpang@redhat.com Cc: linux-kernel@vger.kernel.org, mathieu.desnoyers@efficios.com, jdesfossez@efficios.com, bristot@redhat.com, peterz@infradead.org Subject: [RFC][PATCH 4/8] rtmutex: Remove rt_mutex_fastunlock() References: <20160607195635.710022345@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline; filename=peterz-cleanup-rt-mutex-1.patch Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org There is but a single user and the previous patch mandates slowfn must be rt_mutex_slowunlock(), so fold the lot together and save a few lines. Signed-off-by: Peter Zijlstra (Intel) --- kernel/locking/rtmutex.c | 29 ++++++++++------------------- 1 file changed, 10 insertions(+), 19 deletions(-) --- a/kernel/locking/rtmutex.c +++ b/kernel/locking/rtmutex.c @@ -1377,24 +1377,6 @@ rt_mutex_fasttrylock(struct rt_mutex *lo return slowfn(lock); } -static inline void -rt_mutex_fastunlock(struct rt_mutex *lock, - bool (*slowfn)(struct rt_mutex *lock, - struct wake_q_head *wqh)) -{ - WAKE_Q(wake_q); - - if (likely(rt_mutex_cmpxchg_release(lock, current, NULL))) { - rt_mutex_deadlock_account_unlock(current); - - } else { - bool deboost = slowfn(lock, &wake_q); - - rt_mutex_postunlock(&wake_q, deboost); - } -} - - /* * Undo pi boosting (if necessary) and wake top waiter. */ @@ -1501,7 +1483,16 @@ EXPORT_SYMBOL_GPL(rt_mutex_trylock); */ void __sched rt_mutex_unlock(struct rt_mutex *lock) { - rt_mutex_fastunlock(lock, rt_mutex_slowunlock); + WAKE_Q(wake_q); + + if (likely(rt_mutex_cmpxchg_release(lock, current, NULL))) { + rt_mutex_deadlock_account_unlock(current); + + } else { + bool deboost = rt_mutex_slowunlock(lock, &wake_q); + + rt_mutex_postunlock(&wake_q, deboost); + } } EXPORT_SYMBOL_GPL(rt_mutex_unlock);