From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754651AbcB2LWy (ORCPT ); Mon, 29 Feb 2016 06:22:54 -0500 Received: from torg.zytor.com ([198.137.202.12]:54802 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753724AbcB2LWv (ORCPT ); Mon, 29 Feb 2016 06:22:51 -0500 Date: Mon, 29 Feb 2016 03:21:47 -0800 From: tip-bot for Davidlohr Bueso Message-ID: Cc: Will.Deacon@arm.com, mingo@kernel.org, paulmck@us.ibm.com, linux-kernel@vger.kernel.org, Waiman.Long@hpe.com, paulmck@linux.vnet.ibm.com, akpm@linux-foundation.org, dingtianhong@huawei.com, waiman.long@hpe.com, tim.c.chen@linux.intel.com, dave@stgolabs.net, dbueso@suse.de, peterz@infradead.org, torvalds@linux-foundation.org, jason.low2@hp.com, hpa@zytor.com, tglx@linutronix.de Reply-To: tim.c.chen@linux.intel.com, peterz@infradead.org, dbueso@suse.de, dave@stgolabs.net, torvalds@linux-foundation.org, jason.low2@hp.com, hpa@zytor.com, tglx@linutronix.de, paulmck@us.ibm.com, mingo@kernel.org, Will.Deacon@arm.com, paulmck@linux.vnet.ibm.com, akpm@linux-foundation.org, linux-kernel@vger.kernel.org, Waiman.Long@hpe.com, waiman.long@hpe.com, dingtianhong@huawei.com In-Reply-To: <20160125022343.GA3322@linux-uzut.site> References: <20160125022343.GA3322@linux-uzut.site> To: linux-tip-commits@vger.kernel.org Subject: [tip:locking/core] locking/mutex: Allow next waiter lockless wakeup Git-Commit-ID: 1329ce6fbbe4536592dfcfc8d64d61bfeb598fe6 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 1329ce6fbbe4536592dfcfc8d64d61bfeb598fe6 Gitweb: http://git.kernel.org/tip/1329ce6fbbe4536592dfcfc8d64d61bfeb598fe6 Author: Davidlohr Bueso AuthorDate: Sun, 24 Jan 2016 18:23:43 -0800 Committer: Ingo Molnar CommitDate: Mon, 29 Feb 2016 10:02:42 +0100 locking/mutex: Allow next waiter lockless wakeup Make use of wake-queues and enable the wakeup to occur after releasing the wait_lock. This is similar to what we do with rtmutex top waiter, slightly shortening the critical region and allow other waiters to acquire the wait_lock sooner. In low contention cases it can also help the recently woken waiter to find the wait_lock available (fastpath) when it continues execution. Reviewed-by: Waiman Long Signed-off-by: Davidlohr Bueso Signed-off-by: Peter Zijlstra (Intel) Cc: Andrew Morton Cc: Ding Tianhong Cc: Jason Low Cc: Linus Torvalds Cc: Paul E. McKenney Cc: Paul E. McKenney Cc: Peter Zijlstra Cc: Thomas Gleixner Cc: Tim Chen Cc: Waiman Long Cc: Will Deacon Link: http://lkml.kernel.org/r/20160125022343.GA3322@linux-uzut.site Signed-off-by: Ingo Molnar --- kernel/locking/mutex.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/kernel/locking/mutex.c b/kernel/locking/mutex.c index 0551c21..e364b42 100644 --- a/kernel/locking/mutex.c +++ b/kernel/locking/mutex.c @@ -716,6 +716,7 @@ static inline void __mutex_unlock_common_slowpath(struct mutex *lock, int nested) { unsigned long flags; + WAKE_Q(wake_q); /* * As a performance measurement, release the lock before doing other @@ -743,11 +744,11 @@ __mutex_unlock_common_slowpath(struct mutex *lock, int nested) struct mutex_waiter, list); debug_mutex_wake_waiter(lock, waiter); - - wake_up_process(waiter->task); + wake_q_add(&wake_q, waiter->task); } spin_unlock_mutex(&lock->wait_lock, flags); + wake_up_q(&wake_q); } /*