aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/locking
diff options
context:
space:
mode:
authorJason Low <jason.low2@hp.com>2014-06-11 14:37:20 -0400
committerIngo Molnar <mingo@kernel.org>2014-07-05 05:25:41 -0400
commit0c3c0f0d6e56422cef60a33726d062e9923005c3 (patch)
tree612fd6fff48435b2a49f8e2c26a08a576fdb2206 /kernel/locking
parent6cc620bc8e9b521e61f04eefbec0c41c01fb03b9 (diff)
locking/mutexes: Correct documentation on mutex optimistic spinning
The mutex optimistic spinning documentation states that we spin for acquisition when we find that there are no pending waiters. However, in actuality, whether or not there are waiters for the mutex doesn't determine if we will spin for it. This patch removes that statement and also adds a comment which mentions that we spin for the mutex while we don't need to reschedule. Signed-off-by: Jason Low <jason.low2@hp.com> Acked-by: Davidlohr Bueso <davidlohr@hp.com> Signed-off-by: Peter Zijlstra <peterz@infradead.org> Cc: akpm@linux-foundation.org Cc: tim.c.chen@linux.intel.com Cc: paulmck@linux.vnet.ibm.com Cc: rostedt@goodmis.org Cc: Waiman.Long@hp.com Cc: scott.norton@hp.com Cc: aswin@hp.com Cc: Linus Torvalds <torvalds@linux-foundation.org> Link: http://lkml.kernel.org/r/1402511843-4721-2-git-send-email-jason.low2@hp.com Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'kernel/locking')
-rw-r--r--kernel/locking/mutex.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/kernel/locking/mutex.c b/kernel/locking/mutex.c
index bc73d33c6760..dd26bf6dee0c 100644
--- a/kernel/locking/mutex.c
+++ b/kernel/locking/mutex.c
@@ -388,12 +388,10 @@ __mutex_lock_common(struct mutex *lock, long state, unsigned int subclass,
388 /* 388 /*
389 * Optimistic spinning. 389 * Optimistic spinning.
390 * 390 *
391 * We try to spin for acquisition when we find that there are no 391 * We try to spin for acquisition when we find that the lock owner
392 * pending waiters and the lock owner is currently running on a 392 * is currently running on a (different) CPU and while we don't
393 * (different) CPU. 393 * need to reschedule. The rationale is that if the lock owner is
394 * 394 * running, it is likely to release the lock soon.
395 * The rationale is that if the lock owner is running, it is likely to
396 * release the lock soon.
397 * 395 *
398 * Since this needs the lock owner, and this mutex implementation 396 * Since this needs the lock owner, and this mutex implementation
399 * doesn't track the owner atomically in the lock field, we need to 397 * doesn't track the owner atomically in the lock field, we need to