Repository navigation
Commit 30da688
sched: sched_exec(): Remove the select_fallback_rq() logic
sched_exec()->select_task_rq() reads/updates ->cpus_allowed lockless.
This can race with other CPUs updating our ->cpus_allowed, and this
looks meaningless to me.
The task is current and running, it must have online cpus in ->cpus_allowed,
the fallback mode is bogus. And, if ->sched_class returns the "wrong" cpu,
this likely means we raced with set_cpus_allowed() which was called
for reason, why should sched_exec() retry and call ->select_task_rq()
again?
Change the code to call sched_class->select_task_rq() directly and do
nothing if the returned cpu is wrong after re-checking under rq->lock.
From now task_struct->cpus_allowed is always stable under TASK_WAKING,
select_fallback_rq() is always called under rq-lock or the caller or
the caller owns TASK_WAKING (select_task_rq).
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <20100315091019.GA9141@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>1 parent c1804d5 commit 30da688
1 file changed
Lines changed: 8 additions & 17 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2280 | 2280 | | |
2281 | 2281 | | |
2282 | 2282 | | |
| 2283 | + | |
| 2284 | + | |
| 2285 | + | |
2283 | 2286 | | |
2284 | 2287 | | |
2285 | 2288 | | |
| |||
2316 | 2319 | | |
2317 | 2320 | | |
2318 | 2321 | | |
2319 | | - | |
2320 | | - | |
2321 | | - | |
2322 | | - | |
2323 | | - | |
2324 | | - | |
| 2322 | + | |
2325 | 2323 | | |
2326 | 2324 | | |
2327 | 2325 | | |
| |||
3076 | 3074 | | |
3077 | 3075 | | |
3078 | 3076 | | |
3079 | | - | |
3080 | 3077 | | |
3081 | | - | |
| 3078 | + | |
3082 | 3079 | | |
3083 | 3080 | | |
3084 | 3081 | | |
3085 | 3082 | | |
3086 | 3083 | | |
3087 | 3084 | | |
3088 | 3085 | | |
3089 | | - | |
3090 | 3086 | | |
3091 | 3087 | | |
3092 | 3088 | | |
3093 | | - | |
3094 | | - | |
3095 | | - | |
3096 | | - | |
3097 | | - | |
3098 | | - | |
3099 | | - | |
3100 | | - | |
| 3089 | + | |
| 3090 | + | |
| 3091 | + | |
3101 | 3092 | | |
3102 | 3093 | | |
3103 | 3094 | | |
| |||
0 commit comments