From: Satoru Takeuchi Fix ksoftirqd termination on cpu hotplug with naughty real time process. Assuming the following case: - Try to hot remove CPU2 from CPU1. - There is a real time process on CPU2, and that process doesn't sleep at all. - That rt process and ksoftirqd/2 is migrated to the CPU0 Then ksoftirqd/2 can't stop becasue that rt process runs everlastingly on CPU0, and CPU1 waiting the ksoftirqd/2's termination hangs up. To fix this problem, set the priority of ksoftirqd/2 to max one before kthread_stop(). Signed-off-by: Satoru Takeuchi Cc: Rusty Russell Cc: Ingo Molnar Cc: Oleg Nesterov Cc: Ashok Raj Cc: Gautham R Shenoy Signed-off-by: Andrew Morton --- kernel/softirq.c | 2 ++ 1 file changed, 2 insertions(+) diff -puN kernel/softirq.c~cpu-hotplug-fix-ksoftirqd-termination-on-cpu-hotplug-with-naughty-realtime-process kernel/softirq.c --- a/kernel/softirq.c~cpu-hotplug-fix-ksoftirqd-termination-on-cpu-hotplug-with-naughty-realtime-process +++ a/kernel/softirq.c @@ -585,6 +585,7 @@ static int __cpuinit cpu_callback(struct { int hotcpu = (unsigned long)hcpu; struct task_struct *p; + struct sched_param param = { .sched_priority = MAX_RT_PRIO-1 }; switch (action) { case CPU_UP_PREPARE: @@ -613,6 +614,7 @@ static int __cpuinit cpu_callback(struct case CPU_DEAD_FROZEN: p = per_cpu(ksoftirqd, hotcpu); per_cpu(ksoftirqd, hotcpu) = NULL; + sched_setscheduler(p, SCHED_FIFO, ¶m); kthread_stop(p); takeover_tasklets(hotcpu); break; _