* [tip:core/locking] locking/mutexes: Add extra reschedule point
@ 2014-03-11 12:41 tip-bot for Peter Zijlstra
0 siblings, 0 replies; only message in thread
From: tip-bot for Peter Zijlstra @ 2014-03-11 12:41 UTC (permalink / raw)
To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, peterz, tglx
Commit-ID: 34c6bc2c919a55e5ad4e698510a2f35ee13ab900
Gitweb: http://git.kernel.org/tip/34c6bc2c919a55e5ad4e698510a2f35ee13ab900
Author: Peter Zijlstra <peterz@infradead.org>
AuthorDate: Mon, 3 Feb 2014 16:21:09 +0100
Committer: Ingo Molnar <mingo@kernel.org>
CommitDate: Tue, 11 Mar 2014 12:14:59 +0100
locking/mutexes: Add extra reschedule point
Add in an extra reschedule in an attempt to avoid getting reschedule
the moment we've acquired the lock.
Signed-off-by: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/n/tip-zah5eyn9gu7qlgwh9r6n2anc@git.kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
kernel/locking/mutex.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/kernel/locking/mutex.c b/kernel/locking/mutex.c
index 2670b84..02c61a9 100644
--- a/kernel/locking/mutex.c
+++ b/kernel/locking/mutex.c
@@ -468,6 +468,13 @@ __mutex_lock_common(struct mutex *lock, long state, unsigned int subclass,
}
osq_unlock(&lock->osq);
slowpath:
+ /*
+ * If we fell out of the spin path because of need_resched(),
+ * reschedule now, before we try-lock the mutex. This avoids getting
+ * scheduled out right after we obtained the mutex.
+ */
+ if (need_resched())
+ schedule_preempt_disabled();
#endif
spin_lock_mutex(&lock->wait_lock, flags);
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2014-03-11 12:42 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-11 12:41 [tip:core/locking] locking/mutexes: Add extra reschedule point tip-bot for Peter Zijlstra
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome