From: yaozhenguo <yaozhenguo1@gmail.com>
To: mingo@redhat.com, peterz@infradead.org, vincent.guittot@linaro.org
Cc: linux-kernel@vger.kernel.org, yaozhenguo@jd.com,
ZhenguoYao <yaozhenguo1@gmail.com>
Subject: [PATCH] sched/fair: Introduce WAKEUP_SELECT_IDLE sched feature
Date: Tue, 12 Aug 2025 18:16:50 +0800 [thread overview]
Message-ID: <20250812101650.44110-1-yaozhenguo@jd.com> (raw)
From: ZhenguoYao <yaozhenguo1@gmail.com>
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/cover.1561523542.git.viresh.kumar@linaro.org/
Signed-off-by: ZhenguoYao <yaozhenguo1@gmail.com>
---
kernel/sched/fair.c | 5 ++++-
kernel/sched/features.h | 2 ++
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index b173a059315c..2d1629086307 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -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
diff --git a/kernel/sched/features.h b/kernel/sched/features.h
index 3c12d9f93331..bf23a9dc6e05 100644
--- a/kernel/sched/features.h
+++ b/kernel/sched/features.h
@@ -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)
--
2.43.5
reply other threads:[~2025-08-12 10:17 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250812101650.44110-1-yaozhenguo@jd.com \
--to=yaozhenguo1@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=vincent.guittot@linaro.org \
--cc=yaozhenguo@jd.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®