diff options
author | Peter Zijlstra <peterz@infradead.org> | 2021-06-11 10:28:11 +0200 |
---|---|---|
committer | Peter Zijlstra <peterz@infradead.org> | 2021-06-18 11:43:06 +0200 |
commit | 37aadc687ab441bbcb693ddae613acf9afcea1ab (patch) | |
tree | 83a8142d60076d6742205e513fc0fac6c0435fa5 /kernel/softirq.c | |
parent | b2c0931a07b7376c6291e0cfb347ad27f7b66263 (diff) |
sched: Unbreak wakeups
Remove broken task->state references and let wake_up_process() DTRT.
The anti-pattern in these patches breaks the ordering of ->state vs
COND as described in the comment near set_current_state() and can lead
to missed wakeups:
(OoO load, observes RUNNING)<-.
for (;;) { |
t->state = UNINTERRUPTIBLE; |
smp_mb(); ,-----> | (observes !COND)
| /
if (COND) ---------' | COND = 1;
break; `- if (t->state != RUNNING)
wake_up_process(t); // not done
schedule(); // forever waiting
}
t->state = TASK_RUNNING;
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Davidlohr Bueso <dbueso@suse.de>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Acked-by: Will Deacon <will@kernel.org>
Link: https://lore.kernel.org/r/20210611082838.160855222@infradead.org
Diffstat (limited to 'kernel/softirq.c')
-rw-r--r-- | kernel/softirq.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/kernel/softirq.c b/kernel/softirq.c index 4992853ef53d..5ddc3b15a4db 100644 --- a/kernel/softirq.c +++ b/kernel/softirq.c @@ -76,7 +76,7 @@ static void wakeup_softirqd(void) /* Interrupts are disabled: no need to stop preemption */ struct task_struct *tsk = __this_cpu_read(ksoftirqd); - if (tsk && tsk->state != TASK_RUNNING) + if (tsk) wake_up_process(tsk); } |