Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1434998 > unrolled thread
| Started by | "T.Zhou" <t1zhou@163.com> |
|---|---|
| First post | 2016-07-01 05:40 +0200 |
| Last post | 2016-07-01 10:50 +0200 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH] sched: Assign !p->on_cpu to the second parameter of smp_cond_load_acquire() "T.Zhou" <t1zhou@163.com> - 2016-07-01 05:40 +0200
Re: [PATCH] sched: Assign !p->on_cpu to the second parameter of smp_cond_load_acquire() Peter Zijlstra <peterz@infradead.org> - 2016-07-01 10:50 +0200
| From | "T.Zhou" <t1zhou@163.com> |
|---|---|
| Date | 2016-07-01 05:40 +0200 |
| Subject | [PATCH] sched: Assign !p->on_cpu to the second parameter of smp_cond_load_acquire() |
| Message-ID | <rPXt7-1tk-1@gated-at.bofh.it> |
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
[toc] | [next] | [standalone]
| From | Peter Zijlstra <peterz@infradead.org> |
|---|---|
| Date | 2016-07-01 10:50 +0200 |
| Message-ID | <rQ2j8-4pm-5@gated-at.bofh.it> |
| In reply to | #1434998 |
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.
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web