[tip: sched/core] sched: Decouple PREFERRED_CPU from PARAVIRT
From: tip-bot2 for Mete Durlu
Date: Mon Nov 09 2026 - 03:50:26 EST
The following commit has been merged into the sched/core branch of tip:
Commit-ID: ae7ff8b29958143b4f23169a5598c860334db2fa
Gitweb: https://git.kernel.org/tip/ae7ff8b29958143b4f23169a5598c860334db2fa
Author: Mete Durlu <meted@xxxxxxxxxxxxx>
AuthorDate: Fri, 06 Nov 2026 13:35:12 +01:00
Committer: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
CommitterDate: Mon, 09 Nov 2026 09:39:59 +01:00
sched: Decouple PREFERRED_CPU from PARAVIRT
PREFERRED_CPU mechanism does not rely on any feature introduced by PARAVIRT
but PREFERRED_CPU still gated behind PARAVIRT. Any architecture that
would like to enable PREFERRED_CPU mechanism has to also enable PARAVIRT
and bring additional changes to accommodate PARAVIRT's requirements.
As an example, s390 doesn't enable PARAVIRT config for hardware virtualized
Logical Partitions (LPAR). The steal time is accounted for the LPARs via
architecture's own steal time accounting mechanism instead of the common
steal time infrastructure PARAVIRT supplies.
For s390 to enable PREFERRED_CPU, PRAVIRT and its required stubs are
just unncessary.
Based on the discussion between Yury Norov and Peter Zijlstra over
Yury's original patch [1]:
Introduce a new config flag HAVE_CPUTIME_STEAL to indicate that the
architecture has steal time measurement capabilities already implemented
and to signal that PARAVIRT is not required.
Remove PARAVIRT gating from CPU_PREFERRED and add HAVE_CPUTIME_STEAL
instead.
Select HAVE_CPUTIME_STEAL for s390 and powerpc-pseries configs.
[1] https://lore.kernel.org/all/20261101192203.6979-2-ynorov@xxxxxxxxxx/
Suggested-by: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
Signed-off-by: Mete Durlu <meted@xxxxxxxxxxxxx>
Signed-off-by: Peter Zijlstra (Intel) <peterz@xxxxxxxxxxxxx>
Reviewed-by: Yury Norov <ynorov@xxxxxxxxxx>
Reviewed-by: Shrikanth Hegde <sshegde@xxxxxxxxxxxxx>
Link: https://patch.msgid.link/20261106-preferredcpu-v1-1-3f0ca4944f8b@xxxxxxxxxxxxx
---
arch/Kconfig | 8 ++++++++
arch/powerpc/platforms/pseries/Kconfig | 1 +
arch/s390/Kconfig | 1 +
drivers/virt/Kconfig | 2 +-
kernel/Kconfig.preempt | 2 +-
5 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/arch/Kconfig b/arch/Kconfig
index 1163736..01b8251 100644
--- a/arch/Kconfig
+++ b/arch/Kconfig
@@ -1080,6 +1080,14 @@ config HAVE_IRQ_TIME_ACCOUNTING
config HAVE_PV_STEAL_CLOCK_GEN
bool
+config HAVE_CPUTIME_STEAL
+ bool
+ default y if HAVE_PV_STEAL_CLOCK_GEN
+ help
+ Selected directly by config PARAVIRT through HAVE_PV_STEAL_CLOCK_GEN
+ or directly by architectures that have their own CPUTIME_STEAL
+ accounting.
+
config HAVE_MOVE_PUD
bool
help
diff --git a/arch/powerpc/platforms/pseries/Kconfig b/arch/powerpc/platforms/pseries/Kconfig
index 7d125e2..3c49baf 100644
--- a/arch/powerpc/platforms/pseries/Kconfig
+++ b/arch/powerpc/platforms/pseries/Kconfig
@@ -41,6 +41,7 @@ config PPC_SPLPAR
depends on PPC_PSERIES
select PARAVIRT_SPINLOCKS if PPC_QUEUED_SPINLOCKS
select PARAVIRT_TIME_ACCOUNTING if VIRT_CPU_ACCOUNTING_GEN
+ select HAVE_CPUTIME_STEAL
default y
help
Enabling this option will make the kernel run more efficiently
diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig
index 7138d92..39379e7 100644
--- a/arch/s390/Kconfig
+++ b/arch/s390/Kconfig
@@ -204,6 +204,7 @@ config S390
select HAVE_BUILDTIME_MCOUNT_SORT
select HAVE_CMPXCHG_DOUBLE
select HAVE_CMPXCHG_LOCAL
+ select HAVE_CPUTIME_STEAL
select HAVE_DEBUG_KMEMLEAK
select HAVE_DMA_CONTIGUOUS
select HAVE_DYNAMIC_FTRACE
diff --git a/drivers/virt/Kconfig b/drivers/virt/Kconfig
index eeb84e5..a3721d3 100644
--- a/drivers/virt/Kconfig
+++ b/drivers/virt/Kconfig
@@ -43,7 +43,7 @@ config FSL_HV_MANAGER
config STEAL_GOVERNOR
tristate "Dynamic vCPU management based on steal time"
- depends on PARAVIRT && SMP
+ depends on SMP && HAVE_CPUTIME_STEAL
select PREFERRED_CPU
default m
help
diff --git a/kernel/Kconfig.preempt b/kernel/Kconfig.preempt
index edc067a..ffd2cb2 100644
--- a/kernel/Kconfig.preempt
+++ b/kernel/Kconfig.preempt
@@ -197,4 +197,4 @@ config SCHED_CLASS_EXT
config PREFERRED_CPU
bool
- depends on SMP && PARAVIRT
+ depends on SMP && HAVE_CPUTIME_STEAL