[PATCH] sched: Assign !p->on_cpu to the second parameter of smp_cond_load_acquire()

T.Zhou
2016-07-01T03:36:19Z

The second parameter of smp_cond_load_acquire() should be !p->on_cpu
cause remote wakeup need to ensure that: if the task is running on
prev cpu, it should be descheduled before doing the actual wakeup.

Signed-off-by: T.Zhou <t1zhou@163.com>
---
kernel/sched/core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 3387e4f..8e6fef6 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -2047,7 +2047,7 @@ try_to_wake_up(struct task_struct *p, unsigned int state, int wake_flags)
* This ensures that tasks getting woken will be fully ordered against
* their previous state and preserve Program Order.
*/
- smp_cond_load_acquire(&p->on_cpu, !VAL);
+ smp_cond_load_acquire(&p->on_cpu, !p->on_cpu);

p->sched_contributes_to_load = !!task_contributes_to_load(p);
p->state = TASK_WAKING;
--
2.7.3