Commit bd44e3f1 authored by Davidlohr Bueso's avatar Davidlohr Bueso Committed by Greg Kroah-Hartman

locking/mutex: Allow next waiter lockless wakeup

commit 1329ce6f upstream.

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: default avatarWaiman Long <Waiman.Long@hpe.com>
Signed-off-by: default avatarDavidlohr Bueso <dbueso@suse.de>
Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Ding Tianhong <dingtianhong@huawei.com>
Cc: Jason Low <jason.low2@hp.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Cc: Paul E. McKenney <paulmck@us.ibm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Tim Chen <tim.c.chen@linux.intel.com>
Cc: Waiman Long <waiman.long@hpe.com>
Cc: Will Deacon <Will.Deacon@arm.com>
Link: http://lkml.kernel.org/r/20160125022343.GA3322@linux-uzut.siteSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 1920b8a6
...@@ -719,6 +719,7 @@ static inline void ...@@ -719,6 +719,7 @@ static inline void
__mutex_unlock_common_slowpath(struct mutex *lock, int nested) __mutex_unlock_common_slowpath(struct mutex *lock, int nested)
{ {
unsigned long flags; unsigned long flags;
WAKE_Q(wake_q);
/* /*
* As a performance measurement, release the lock before doing other * As a performance measurement, release the lock before doing other
...@@ -746,11 +747,11 @@ __mutex_unlock_common_slowpath(struct mutex *lock, int nested) ...@@ -746,11 +747,11 @@ __mutex_unlock_common_slowpath(struct mutex *lock, int nested)
struct mutex_waiter, list); struct mutex_waiter, list);
debug_mutex_wake_waiter(lock, waiter); debug_mutex_wake_waiter(lock, waiter);
wake_q_add(&wake_q, waiter->task);
wake_up_process(waiter->task);
} }
spin_unlock_mutex(&lock->wait_lock, flags); spin_unlock_mutex(&lock->wait_lock, flags);
wake_up_q(&wake_q);
} }
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment