From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933788AbcAYXCg (ORCPT ); Mon, 25 Jan 2016 18:02:36 -0500 Received: from g1t6213.austin.hp.com ([15.73.96.121]:43372 "EHLO g1t6213.austin.hp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933449AbcAYXCf (ORCPT ); Mon, 25 Jan 2016 18:02:35 -0500 Message-ID: <56A6A985.2020202@hpe.com> Date: Mon, 25 Jan 2016 18:02:29 -0500 From: Waiman Long User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.12) Gecko/20130109 Thunderbird/10.0.12 MIME-Version: 1.0 To: Davidlohr Bueso CC: Ding Tianhong , Peter Zijlstra , Ingo Molnar , "linux-kernel@vger.kernel.org" , Linus Torvalds , "Paul E. McKenney" , Thomas Gleixner , Will Deacon , Jason Low , Tim Chen , Waiman Long Subject: Re: [PATCH] locking/mutex: Allow next waiter lockless wakeup References: <56A0A4ED.3070308@huawei.com> <56A1638A.7050202@hpe.com> <20160122060944.GA28537@linux-uzut.site> <56A230C3.4070801@hpe.com> <20160122164630.GA1633@linux-uzut.site> <20160125022343.GA3322@linux-uzut.site> In-Reply-To: <20160125022343.GA3322@linux-uzut.site> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 01/24/2016 09:23 PM, Davidlohr Bueso wrote: > Make use of wake_q 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. > > Signed-off-by: Davidlohr Bueso > --- > 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); > } > > /* This patch looks good to me. Reviewed-by: Waiman Long