The previous patch lifted the deadline bandwidth check during the kexec process, which raises a potential issue: as the number of online CPUs decreases, DL tasks may be crowded onto a few CPUs, which may starve the CPU hotplug kthread. As a result, the hot-removal cannot proceed in practice. On the other hand, as CPUs are offlined one by one, all tasks will eventually be migrated to the kexec CPU.
Therefore, this patch marks all other CPUs as inactive to signal the scheduler to migrate tasks to the kexec CPU during hot-removal. Signed-off-by: Pingfan Liu <[email protected]> Cc: Waiman Long <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Juri Lelli <[email protected]> Cc: Pierre Gondois <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: [email protected] To: [email protected] --- kernel/cpu.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/kernel/cpu.c b/kernel/cpu.c index db9f6c539b28c..76aa0f784602b 100644 --- a/kernel/cpu.c +++ b/kernel/cpu.c @@ -1546,6 +1546,16 @@ void smp_shutdown_nonboot_cpus(unsigned int primary_cpu) if (!cpu_online(primary_cpu)) primary_cpu = cpumask_first(cpu_online_mask); + /* + * Mark all other CPUs as inactive so the scheduler won't select them as + * migration targets. + */ + for_each_online_cpu(cpu) { + if (cpu == primary_cpu) + continue; + set_cpu_active(cpu, false); + } + for_each_online_cpu(cpu) { if (cpu == primary_cpu) continue; -- 2.49.0
