Re: [PATCH 3/6] sched: Restore preferred CPUs when hotplug removes the last one

From
Yury Norov <hidden>
Date
2026-11-05 13:27:29
Also in
driver-core, linux-s390, lkml
Reply to
Fushuai Wang, 2026-11-05
On Thu, Nov 05, 2026 at 05:05:05PM +0800, Fushuai Wang wrote:
quoted
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 04b62c16fa8c..98f4f9434965 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -8712,6 +8712,14 @@ int sched_cpu_deactivate(unsigned int cpu)
 
 	set_cpu_active(cpu, false);
 
+#ifdef CONFIG_PREFERRED_CPU
+	if (cpumask_empty(cpu_preferred_mask)) {
+		pr_notice("sched: last preferred CPU%u offlined; make all active CPUs preferred\n",
+			  cpu);
+		reset_preferred_cpumask();
Hi, Yury

If the CPU being offlined is the only preferred CPU, after
reset_preferred_cpumask(), the steal governor may still need
some time to tighten the mask again, and eventually only one
preferred CPU may remain. Would this introduce additional
task migration overhead?
This is the safest fallback from the scheduler POV. Current steal
governor implementation would require multiple iterations to get back
to the old equilibrium. If it will show up as a real problem, we can
teach steal governor to converge faster, and/or detect the preferred
mask reset.

Thanks,
Yury
Thread (30 messages) 30 messages, 7 authors, last reply 8d ago
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help