diff options
author | Jason Low <jason.low2@hp.com> | 2014-01-28 14:13:12 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2014-03-11 07:14:52 -0400 |
commit | 46af29e479cc0c1c63633007993af5292c2c3e75 (patch) | |
tree | 2d229487a929757e062cd9765263023ef762f1f9 /kernel/locking/mutex.c | |
parent | c9122da1e2d29bd6a1475a0d1ce2aa6ac6ea25fa (diff) |
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@hp.com>
Signed-off-by: Peter Zijlstra <peterz@infradead.org>
Cc: Waiman.Long@hp.com
Cc: torvalds@linux-foundation.org
Cc: tglx@linutronix.de
Cc: riel@redhat.com
Cc: akpm@linux-foundation.org
Cc: davidlohr@hp.com
Cc: hpa@zytor.com
Cc: andi@firstfloor.org
Cc: aswin@hp.com
Cc: scott.norton@hp.com
Cc: chegu_vinod@hp.com
Cc: paulmck@linux.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@kernel.org>
Diffstat (limited to 'kernel/locking/mutex.c')
-rw-r--r-- | kernel/locking/mutex.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/kernel/locking/mutex.c b/kernel/locking/mutex.c index 4f408be39a07..e6d646b18d6c 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) | |||
166 | struct task_struct *owner; | 166 | struct task_struct *owner; |
167 | int retval = 1; | 167 | int retval = 1; |
168 | 168 | ||
169 | if (need_resched()) | ||
170 | return 0; | ||
171 | |||
169 | rcu_read_lock(); | 172 | rcu_read_lock(); |
170 | owner = ACCESS_ONCE(lock->owner); | 173 | owner = ACCESS_ONCE(lock->owner); |
171 | if (owner) | 174 | if (owner) |