Commit 0eca95c
committed
sched_ext: Short-circuit sched_class operations on dead tasks
7900aa6 ("sched_ext: Fix cgroup exit ordering by moving sched_ext_free()
to finish_task_switch()") moved sched_ext_free() to finish_task_switch() and
renamed it to sched_ext_dead() to fix cgroup exit ordering issues. However,
this created a race window where certain sched_class ops may be invoked on
dead tasks leading to failures - e.g. sched_setscheduler() may try to switch a
task which finished sched_ext_dead() back into SCX triggering invalid SCX task
state transitions.
Add task_dead_and_done() which tests whether a task is TASK_DEAD and has
completed its final context switch, and use it to short-circuit sched_class
operations which may be called on dead tasks.
Fixes: 7900aa6 ("sched_ext: Fix cgroup exit ordering by moving sched_ext_free() to finish_task_switch()")
Reported-by: Andrea Righi <[email protected]>
Link: http://lkml.kernel.org/r/[email protected]
Reviewed-by: Andrea Righi <[email protected]>
Signed-off-by: Tejun Heo <[email protected]>1 parent c9894e6 commit 0eca95c
1 file changed
Lines changed: 48 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
194 | 194 | | |
195 | 195 | | |
196 | 196 | | |
| 197 | + | |
197 | 198 | | |
198 | 199 | | |
199 | 200 | | |
| |||
2618 | 2619 | | |
2619 | 2620 | | |
2620 | 2621 | | |
| 2622 | + | |
| 2623 | + | |
| 2624 | + | |
2621 | 2625 | | |
2622 | 2626 | | |
2623 | 2627 | | |
| |||
3033 | 3037 | | |
3034 | 3038 | | |
3035 | 3039 | | |
| 3040 | + | |
| 3041 | + | |
| 3042 | + | |
| 3043 | + | |
| 3044 | + | |
| 3045 | + | |
| 3046 | + | |
| 3047 | + | |
| 3048 | + | |
| 3049 | + | |
| 3050 | + | |
| 3051 | + | |
| 3052 | + | |
| 3053 | + | |
| 3054 | + | |
| 3055 | + | |
| 3056 | + | |
| 3057 | + | |
| 3058 | + | |
| 3059 | + | |
| 3060 | + | |
| 3061 | + | |
| 3062 | + | |
| 3063 | + | |
| 3064 | + | |
| 3065 | + | |
| 3066 | + | |
| 3067 | + | |
| 3068 | + | |
3036 | 3069 | | |
3037 | 3070 | | |
3038 | 3071 | | |
3039 | 3072 | | |
| 3073 | + | |
| 3074 | + | |
| 3075 | + | |
| 3076 | + | |
| 3077 | + | |
| 3078 | + | |
3040 | 3079 | | |
3041 | 3080 | | |
3042 | 3081 | | |
| |||
3062 | 3101 | | |
3063 | 3102 | | |
3064 | 3103 | | |
| 3104 | + | |
| 3105 | + | |
| 3106 | + | |
3065 | 3107 | | |
3066 | 3108 | | |
3067 | 3109 | | |
| |||
3076 | 3118 | | |
3077 | 3119 | | |
3078 | 3120 | | |
| 3121 | + | |
| 3122 | + | |
| 3123 | + | |
3079 | 3124 | | |
3080 | 3125 | | |
3081 | 3126 | | |
| |||
3089 | 3134 | | |
3090 | 3135 | | |
3091 | 3136 | | |
| 3137 | + | |
| 3138 | + | |
| 3139 | + | |
3092 | 3140 | | |
3093 | 3141 | | |
3094 | 3142 | | |
| |||
0 commit comments