[PATCH RFC 2/2] s390/topology: Enable SCHED_IDLE_SMT_PRIO

From: Mete Durlu

Date: Thu Oct 08 2026 - 04:37:57 EST


On s390, vertical polarization configuration assigns CPUs different
polarization values and capacities. These capacities represent the
virtual runtime being assigned to the shared CPUs by the underlying
hypervisor. Consequently running load on high capacity cores, even if
the SMT sibling (SMT=2 on s390) of a given core is busy is more
favorable compared to a fully idle low capacity CPU.

Implement arch_needs_idle_smt_prio() to enable the sched_idle_smt_prio
static branch when the machine has hardware backed topology.

Signed-off-by: Mete Durlu <meted@xxxxxxxxxxxxx>
---
arch/s390/Kconfig | 1 +
arch/s390/include/asm/topology.h | 5 +++++
arch/s390/kernel/topology.c | 9 +++++++++
3 files changed, 15 insertions(+)

diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig
index 4b51bc6e8948..bd6c826a24af 100644
--- a/arch/s390/Kconfig
+++ b/arch/s390/Kconfig
@@ -564,6 +564,7 @@ config NODES_SHIFT
config SCHED_TOPOLOGY
def_bool y
prompt "Topology scheduler support"
+ select ARCH_SUPPORTS_SCHED_IDLE_SMT_PRIO
select ARCH_SUPPORTS_SCHED_SMT
select ARCH_SUPPORTS_SCHED_MC
select SCHED_SMT
diff --git a/arch/s390/include/asm/topology.h b/arch/s390/include/asm/topology.h
index 44110847342a..f0f5477565db 100644
--- a/arch/s390/include/asm/topology.h
+++ b/arch/s390/include/asm/topology.h
@@ -49,6 +49,11 @@ void update_cpu_masks(void);
void topology_expect_change(void);
const struct cpumask *cpu_coregroup_mask(int cpu);

+#ifdef CONFIG_SCHED_IDLE_SMT_PRIO
+#define arch_needs_idle_smt_prio arch_needs_idle_smt_prio
+bool arch_needs_idle_smt_prio(void);
+#endif
+
#else /* CONFIG_SCHED_TOPOLOGY */

static inline void topology_init_early(void) { }
diff --git a/arch/s390/kernel/topology.c b/arch/s390/kernel/topology.c
index 42fc0294f543..6f28e2f1afec 100644
--- a/arch/s390/kernel/topology.c
+++ b/arch/s390/kernel/topology.c
@@ -344,6 +344,15 @@ int arch_update_cpu_topology(void)
return rc;
}

+#ifdef CONFIG_SCHED_IDLE_SMT_PRIO
+bool arch_needs_idle_smt_prio(void)
+{
+ if (topology_mode != TOPOLOGY_MODE_HW)
+ return false;
+ return true;
+}
+#endif
+
static void topology_work_fn(struct work_struct *work)
{
rebuild_sched_domains();

--
2.55.0