All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] sched: Assign !p->on_cpu to the second parameter of smp_cond_load_acquire()
@ 2016-07-01  3:08 T.Zhou
  2016-07-01  6:55 ` Peter Zijlstra
  0 siblings, 1 reply; 2+ messages in thread
From: T.Zhou @ 2016-07-01  3:08 UTC (permalink / raw)
  To: peterz; +Cc: mingo, linux-kernel

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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] sched: Assign !p->on_cpu to the second parameter of smp_cond_load_acquire()
  2016-07-01  3:08 [PATCH] sched: Assign !p->on_cpu to the second parameter of smp_cond_load_acquire() T.Zhou
@ 2016-07-01  6:55 ` Peter Zijlstra
  0 siblings, 0 replies; 2+ messages in thread
From: Peter Zijlstra @ 2016-07-01  6:55 UTC (permalink / raw)
  To: T.Zhou; +Cc: mingo, linux-kernel

On Fri, Jul 01, 2016 at 11:08:01AM +0800, T.Zhou wrote:

> -	smp_cond_load_acquire(&p->on_cpu, !VAL);
> +	smp_cond_load_acquire(&p->on_cpu, !p->on_cpu);

Huh, what?! No, the second parameter should very much include VAL, which
gets assigned the value of *(&p->on_cpu).

Go read the macro, it even has a comment on.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-07-01  8:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-01  3:08 [PATCH] sched: Assign !p->on_cpu to the second parameter of smp_cond_load_acquire() T.Zhou
2016-07-01  6:55 ` Peter Zijlstra

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.