[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1390936396-3962-2-git-send-email-jason.low2@hp.com>
Date: Tue, 28 Jan 2014 11:13:12 -0800
From: Jason Low <jason.low2@...com>
To: mingo@...hat.com, peterz@...radead.org, paulmck@...ux.vnet.ibm.com,
Waiman.Long@...com, torvalds@...ux-foundation.org,
tglx@...utronix.de, jason.low2@...com
Cc: linux-kernel@...r.kernel.org, riel@...hat.com,
akpm@...ux-foundation.org, davidlohr@...com, hpa@...or.com,
andi@...stfloor.org, aswin@...com, scott.norton@...com,
chegu_vinod@...com
Subject: [PATCH v2 1/5] mutex: In mutex_can_spin_on_owner(), return false if task need_resched()
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>
---
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 4dd6e4c..85c6be1 100644
--- a/kernel/locking/mutex.c
+++ b/kernel/locking/mutex.c
@@ -212,6 +212,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)
--
1.7.1
--
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