[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <tip-46af29e479cc0c1c63633007993af5292c2c3e75@git.kernel.org>
Date: Tue, 11 Mar 2014 05:41:00 -0700
From: tip-bot for Jason Low <tipbot@...or.com>
To: linux-tip-commits@...r.kernel.org
Cc: linux-kernel@...r.kernel.org, hpa@...or.com, mingo@...nel.org,
peterz@...radead.org, jason.low2@...com, tglx@...utronix.de
Subject: [tip:core/locking] locking/mutexes:
Return false if task need_resched() in mutex_can_spin_on_owner()
Commit-ID: 46af29e479cc0c1c63633007993af5292c2c3e75
Gitweb: http://git.kernel.org/tip/46af29e479cc0c1c63633007993af5292c2c3e75
Author: Jason Low <jason.low2@...com>
AuthorDate: Tue, 28 Jan 2014 11:13:12 -0800
Committer: Ingo Molnar <mingo@...nel.org>
CommitDate: Tue, 11 Mar 2014 12:14:52 +0100
locking/mutexes: Return false if task need_resched() in mutex_can_spin_on_owner()
The mutex_can_spin_on_owner() function should also return false if the
task needs to be rescheduled to avoid entering the MCS queue when it
needs to reschedule.
Signed-off-by: Jason Low <jason.low2@...com>
Signed-off-by: Peter Zijlstra <peterz@...radead.org>
Cc: Waiman.Long@...com
Cc: torvalds@...ux-foundation.org
Cc: tglx@...utronix.de
Cc: riel@...hat.com
Cc: akpm@...ux-foundation.org
Cc: davidlohr@...com
Cc: hpa@...or.com
Cc: andi@...stfloor.org
Cc: aswin@...com
Cc: scott.norton@...com
Cc: chegu_vinod@...com
Cc: paulmck@...ux.vnet.ibm.com
Link: http://lkml.kernel.org/r/1390936396-3962-2-git-send-email-jason.low2@hp.com
Signed-off-by: Ingo Molnar <mingo@...nel.org>
---
kernel/locking/mutex.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/kernel/locking/mutex.c b/kernel/locking/mutex.c
index 4f408be..e6d646b 100644
--- a/kernel/locking/mutex.c
+++ b/kernel/locking/mutex.c
@@ -166,6 +166,9 @@ static inline int mutex_can_spin_on_owner(struct mutex *lock)
struct task_struct *owner;
int retval = 1;
+ if (need_resched())
+ return 0;
+
rcu_read_lock();
owner = ACCESS_ONCE(lock->owner);
if (owner)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists