Commit 37aadc6
Peter Zijlstra
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.org1 parent b2c0931 commit 37aadc6
4 files changed
Lines changed: 9 additions & 17 deletions
File tree
- drivers
- net/ethernet/qualcomm
- usb
- gadget/udc
- host
- kernel
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
653 | 653 | | |
654 | 654 | | |
655 | 655 | | |
656 | | - | |
657 | | - | |
| 656 | + | |
658 | 657 | | |
659 | 658 | | |
660 | 659 | | |
| |||
777 | 776 | | |
778 | 777 | | |
779 | 778 | | |
780 | | - | |
781 | | - | |
| 779 | + | |
782 | 780 | | |
783 | 781 | | |
784 | 782 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
509 | 509 | | |
510 | 510 | | |
511 | 511 | | |
512 | | - | |
513 | | - | |
| 512 | + | |
514 | 513 | | |
515 | 514 | | |
516 | 515 | | |
| |||
529 | 528 | | |
530 | 529 | | |
531 | 530 | | |
532 | | - | |
533 | | - | |
| 531 | + | |
534 | 532 | | |
535 | 533 | | |
536 | 534 | | |
| |||
1093 | 1091 | | |
1094 | 1092 | | |
1095 | 1093 | | |
1096 | | - | |
1097 | | - | |
| 1094 | + | |
1098 | 1095 | | |
1099 | 1096 | | |
1100 | 1097 | | |
| |||
1117 | 1114 | | |
1118 | 1115 | | |
1119 | 1116 | | |
1120 | | - | |
1121 | | - | |
| 1117 | + | |
1122 | 1118 | | |
1123 | 1119 | | |
1124 | 1120 | | |
| |||
1137 | 1133 | | |
1138 | 1134 | | |
1139 | 1135 | | |
1140 | | - | |
1141 | | - | |
| 1136 | + | |
1142 | 1137 | | |
1143 | 1138 | | |
1144 | 1139 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1169 | 1169 | | |
1170 | 1170 | | |
1171 | 1171 | | |
1172 | | - | |
1173 | | - | |
| 1172 | + | |
1174 | 1173 | | |
1175 | 1174 | | |
1176 | 1175 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
76 | 76 | | |
77 | 77 | | |
78 | 78 | | |
79 | | - | |
| 79 | + | |
80 | 80 | | |
81 | 81 | | |
82 | 82 | | |
| |||
0 commit comments