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.
Cc: chegu_vi...@hp.com Cc: paul...@linux.vnet.ibm.com Cc: waiman.l...@hp.com Cc: torva...@linux-foundation.org Cc: t...@linutronix.de Cc: r...@redhat.com Cc: a...@linux-foundation.org Cc: davidl...@hp.com Cc: h...@zytor.com Cc: a...@firstfloor.org Cc: as...@hp.com Cc: mi...@kernel.org Cc: scott.nor...@hp.com Signed-off-by: Jason Low <jason.l...@hp.com> Signed-off-by: Peter Zijlstra <pet...@infradead.org> Link: http://lkml.kernel.org/r/1390936396-3962-2-git-send-email-jason.l...@hp.com --- kernel/locking/mutex.c | 3 +++ 1 file changed, 3 insertions(+) --- a/kernel/locking/mutex.c +++ b/kernel/locking/mutex.c @@ -166,6 +166,9 @@ static inline int mutex_can_spin_on_owne 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 majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/