aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/locking/mutex.c
diff options
context:
space:
mode:
authorDavidlohr Bueso <dave@stgolabs.net>2015-01-06 14:45:05 -0500
committerIngo Molnar <mingo@kernel.org>2015-01-14 09:07:22 -0500
commite42f678a0237f84f0004fbaf0fad0b844751eadd (patch)
treed9de2910392e8644711b014262c3a8e8ef968e17 /kernel/locking/mutex.c
parent63dc47e956b464e0ed3282f6e70974eebf850180 (diff)
locking/mutex: Move MCS related comments to proper location
It serves much better if the comments are right before the osq_lock() call. Also delete a useless comment. Signed-off-by: Davidlohr Bueso <dbueso@suse.de> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Cc: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Linus Torvalds <torvalds@linux-foundation.org> Link: http://lkml.kernel.org/r/1420573509-24774-3-git-send-email-dave@stgolabs.net Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'kernel/locking/mutex.c')
-rw-r--r--kernel/locking/mutex.c16
1 files changed, 5 insertions, 11 deletions
diff --git a/kernel/locking/mutex.c b/kernel/locking/mutex.c
index b042ea57bbea..6db3d0dea6da 100644
--- a/kernel/locking/mutex.c
+++ b/kernel/locking/mutex.c
@@ -193,17 +193,6 @@ ww_mutex_set_context_fastpath(struct ww_mutex *lock,
193 193
194 194
195#ifdef CONFIG_MUTEX_SPIN_ON_OWNER 195#ifdef CONFIG_MUTEX_SPIN_ON_OWNER
196/*
197 * In order to avoid a stampede of mutex spinners from acquiring the mutex
198 * more or less simultaneously, the spinners need to acquire a MCS lock
199 * first before spinning on the owner field.
200 *
201 */
202
203/*
204 * Mutex spinning code migrated from kernel/sched/core.c
205 */
206
207static inline bool owner_running(struct mutex *lock, struct task_struct *owner) 196static inline bool owner_running(struct mutex *lock, struct task_struct *owner)
208{ 197{
209 if (lock->owner != owner) 198 if (lock->owner != owner)
@@ -307,6 +296,11 @@ static bool mutex_optimistic_spin(struct mutex *lock,
307 if (!mutex_can_spin_on_owner(lock)) 296 if (!mutex_can_spin_on_owner(lock))
308 goto done; 297 goto done;
309 298
299 /*
300 * In order to avoid a stampede of mutex spinners trying to
301 * acquire the mutex all at once, the spinners need to take a
302 * MCS (queued) lock first before spinning on the owner field.
303 */
310 if (!osq_lock(&lock->osq)) 304 if (!osq_lock(&lock->osq))
311 goto done; 305 goto done;
312 306