Skip to content

Commit dc7fab8

Browse files
stablebitsIngo Molnar
authored andcommitted
sched: fix cpu hotplug
I think we may have a race between try_to_wake_up() and migrate_live_tasks() -> move_task_off_dead_cpu() when the later one may end up looping endlessly. Interrupts are enabled on other CPUs when migration_call(CPU_DEAD, ...) is called so we may get a race between try_to_wake_up() and migrate_live_tasks() -> move_task_off_dead_cpu(). The former one may push a task out of a dead CPU causing the later one to loop endlessly. Heiko Carstens observed: | That's exactly what explains a dump I got yesterday. Thanks for fixing! :) Signed-off-by: Dmitry Adamushko <[email protected]> Cc: [email protected] Cc: Lai Jiangshan <[email protected]> Cc: Heiko Carstens <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Avi Kivity <[email protected]> Cc: Andrew Morton <[email protected]> Signed-off-by: Ingo Molnar <[email protected]>
1 parent 619b048 commit dc7fab8

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

kernel/sched.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5621,8 +5621,10 @@ static int __migrate_task(struct task_struct *p, int src_cpu, int dest_cpu)
56215621

56225622
double_rq_lock(rq_src, rq_dest);
56235623
/* Already moved. */
5624-
if (task_cpu(p) != src_cpu)
5624+
if (task_cpu(p) != src_cpu) {
5625+
ret = 1;
56255626
goto out;
5627+
}
56265628
/* Affinity changed (again). */
56275629
if (!cpu_isset(dest_cpu, p->cpus_allowed))
56285630
goto out;

0 commit comments

Comments
 (0)