summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--kernel/sched/core.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 960acc06a818..d10482a0c683 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -5,6 +5,8 @@
*
* Copyright (C) 1991-2002 Linus Torvalds
*
+ * Copyright (c) 2014, NVIDIA CORPORATION. All rights reserved.
+ *
* 1996-12-23 Modified by Dave Grothe to fix bugs in semaphores and
* make semaphores SMP safe
* 1998-11-19 Implemented schedule_timeout() and related stuff
@@ -1091,9 +1093,10 @@ unsigned long wait_task_inactive(struct task_struct *p, long match_state)
* is actually now running somewhere else!
*/
while (task_running(rq, p)) {
- if (match_state && unlikely(p->state != match_state))
+ if (match_state && unlikely(cpu_relaxed_read_long
+ (&(p->state)) != match_state))
return 0;
- cpu_relax();
+ cpu_read_relax();
}
/*
@@ -1521,8 +1524,8 @@ try_to_wake_up(struct task_struct *p, unsigned int state, int wake_flags)
* If the owning (remote) cpu is still in the middle of schedule() with
* this task as prev, wait until its done referencing the task.
*/
- while (p->on_cpu)
- cpu_relax();
+ while (cpu_relaxed_read(&(p->on_cpu)))
+ cpu_read_relax();
/*
* Pairs with the smp_wmb() in finish_lock_switch().
*/