Skip to contentSkip to conversation

sched/fair: Introduce WAKEUP_SELECT_IDLE sched feature

PATCH New yaozhenguo 1 participant 1 message Aug 12, 2025 Scheduler

lore
Share & tools
lore

yaozhenguo

author
#0 lore raw

PATCH 1/1 sched/fair: Introduce WAKEUP_SELECT_IDLE sched feature

From: ZhenguoYao <[email protected]>

Introduce WAKEUP_SELECT_IDLE to control if to select CPU only has SCHED_IDLE task or idle cpu.

open it:
echo WAKEUP_SELECT_IDLE > /sys/kernel/debug/sched/features close it:
echo NO_WAKEUP_SELECT_IDLE > /sys/kernel/debug/sched/features

In cloud computing host environments, management and monitoring software are typically configured with SCHED_IDLE priority to avoid interference with normal virtual machine operations. However, if vCPU wakeups consistently select CPU cores running SCHED_IDLE tasks, critical management and monitoring services may fail to execute—even when other idle CPU cores are available in the system.

Our servers operate in performance power mode with idle states ( >2μs) disabled. Consequently, selecting CPU cores running SCHED_IDLE processes yields minimal benefits while introducing excessive latency for monitoring and management software. Although these processes are low-priority, they are not equivalent to offline processes.

To address this, we propose implementing a configurable switch to control whether wakeups may target CPUs executing SCHED_IDLE tasks.

More info:https://lore.kernel.org/lkml/[email protected]/

---
 kernel/sched/fair.c     | 5 ++++-
 kernel/sched/features.h | 2 ++
 2 files changed, 6 insertions(+), 1 deletion(-)
kernel/sched/fair.c +4 -1
index b173a059315c..2d1629086307 100644
@@ -6781,7 +6781,10 @@ static int sched_idle_rq(struct rq *rq)
 
 static int sched_idle_cpu(int cpu)
 {
-	return sched_idle_rq(cpu_rq(cpu));
+	if (sched_feat(WAKEUP_SELECT_IDLE))
+		return sched_idle_rq(cpu_rq(cpu));
+	else
+		return 0;
 }
 
 static void
kernel/sched/features.h +2 -0
index 3c12d9f93331..bf23a9dc6e05 100644
@@ -63,6 +63,8 @@ SCHED_FEAT(DELAY_ZERO, true)
  */
 SCHED_FEAT(WAKEUP_PREEMPTION, true)
 
+SCHED_FEAT(WAKEUP_SELECT_IDLE, true)
+
 SCHED_FEAT(HRTICK, false)
 SCHED_FEAT(HRTICK_DL, false)
 
Signature · 1 line
2.43.5