From: tip-bot for Davidlohr Bueso <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, hpa@zytor.com,
peterz@infradead.org, torvalds@linux-foundation.org,
paulmck@linux.vnet.ibm.com, tglx@linutronix.de, dbueso@suse.de,
mingo@kernel.org, dave@stgolabs.net
Subject: [tip:locking/core] locking/mutex: Move MCS related comments to proper location
Date: Wed, 14 Jan 2015 11:18:54 -0800 [thread overview]
Message-ID: <tip-e42f678a0237f84f0004fbaf0fad0b844751eadd@git.kernel.org> (raw)
In-Reply-To: <1420573509-24774-3-git-send-email-dave@stgolabs.net>
Commit-ID: e42f678a0237f84f0004fbaf0fad0b844751eadd
Gitweb: http://git.kernel.org/tip/e42f678a0237f84f0004fbaf0fad0b844751eadd
Author: Davidlohr Bueso <dave@stgolabs.net>
AuthorDate: Tue, 6 Jan 2015 11:45:05 -0800
Committer: Ingo Molnar <mingo@kernel.org>
CommitDate: Wed, 14 Jan 2015 15:07:22 +0100
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>
---
kernel/locking/mutex.c | 16 +++++-----------
1 file changed, 5 insertions(+), 11 deletions(-)
diff --git a/kernel/locking/mutex.c b/kernel/locking/mutex.c
index b042ea5..6db3d0d 100644
--- a/kernel/locking/mutex.c
+++ b/kernel/locking/mutex.c
@@ -193,17 +193,6 @@ ww_mutex_set_context_fastpath(struct ww_mutex *lock,
#ifdef CONFIG_MUTEX_SPIN_ON_OWNER
-/*
- * In order to avoid a stampede of mutex spinners from acquiring the mutex
- * more or less simultaneously, the spinners need to acquire a MCS lock
- * first before spinning on the owner field.
- *
- */
-
-/*
- * Mutex spinning code migrated from kernel/sched/core.c
- */
-
static inline bool owner_running(struct mutex *lock, struct task_struct *owner)
{
if (lock->owner != owner)
@@ -307,6 +296,11 @@ static bool mutex_optimistic_spin(struct mutex *lock,
if (!mutex_can_spin_on_owner(lock))
goto done;
+ /*
+ * In order to avoid a stampede of mutex spinners trying to
+ * acquire the mutex all at once, the spinners need to take a
+ * MCS (queued) lock first before spinning on the owner field.
+ */
if (!osq_lock(&lock->osq))
goto done;
next prev parent reply other threads:[~2015-01-14 19:19 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-06 19:45 [PATCH -tip v2 0/6] locking: Various updates Davidlohr Bueso
2015-01-06 19:45 ` [PATCH 1/6] locking/mutex: Checking the stamp is ww only Davidlohr Bueso
2015-01-14 19:18 ` [tip:locking/core] locking/mutex: Checking the stamp is WW only tip-bot for Davidlohr Bueso
2015-01-06 19:45 ` [PATCH 2/6] locking/mutex: Move mcs related comments to proper location Davidlohr Bueso
2015-01-14 19:18 ` tip-bot for Davidlohr Bueso [this message]
2015-01-06 19:45 ` [PATCH 3/6] locking/mutex: Introduce ww_mutex_set_context_slowpath Davidlohr Bueso
2015-01-14 19:19 ` [tip:locking/core] locking/mutex: Introduce ww_mutex_set_context_slowpath() tip-bot for Davidlohr Bueso
2015-01-06 19:45 ` [PATCH 4/6] locking/mcs: Better differentiate between mcs variants Davidlohr Bueso
2015-01-14 19:19 ` [tip:locking/core] locking/mcs: Better differentiate between MCS variants tip-bot for Davidlohr Bueso
2015-01-06 19:45 ` [PATCH 5/6] locking: Use [READ,ASSIGN]_ONCE() for non-scalar types Davidlohr Bueso
2015-01-06 19:45 ` [PATCH 6/6] locking/osq: No need for load/acquire when acquire-polling Davidlohr Bueso
2015-01-14 19:20 ` [tip:locking/core] locking/osq: No need for load/ acquire " tip-bot for Davidlohr Bueso
2015-01-07 11:52 ` [PATCH -tip v2 0/6] locking: Various updates Peter Zijlstra
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=tip-e42f678a0237f84f0004fbaf0fad0b844751eadd@git.kernel.org \
--to=tipbot@zytor.com \
--cc=dave@stgolabs.net \
--cc=dbueso@suse.de \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=paulmck@linux.vnet.ibm.com \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.