[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20231026101843.56784-5-srikar@linux.vnet.ibm.com>
Date: Thu, 26 Oct 2023 15:48:39 +0530
From: Srikar Dronamraju <srikar@...ux.vnet.ibm.com>
To: Michael Ellerman <mpe@...erman.id.au>,
Nicholas Piggin <npiggin@...il.com>,
Christophe Leroy <christophe.leroy@...roup.eu>
Cc: linuxppc-dev <linuxppc-dev@...ts.ozlabs.org>,
Srikar Dronamraju <srikar@...ux.vnet.ibm.com>,
linux-kernel@...r.kernel.org, Mark Rutland <mark.rutland@....com>,
"ndesaulniers@...gle.com" <ndesaulniers@...gle.com>,
"Paul E. McKenney" <paulmck@...nel.org>,
"Peter Zijlstra (Intel)" <peterz@...radead.org>,
Rohan McLure <rmclure@...ux.ibm.com>,
Valentin Schneider <vschneid@...hat.com>,
Josh Poimboeuf <jpoimboe@...nel.org>
Subject: [PATCH v3 4/5] powerpc/smp: Avoid asym packing within thread_group of a core
PowerVM Hypervisor will schedule at a core granularity. However each big
core can have more than one thread_groups. For better utilization in
case of a shared processor, its preferable for the scheduler to pack to
the lowest core. However there is no benefit of moving a thread between
two thread groups of the same core.
Signed-off-by: Srikar Dronamraju <srikar@...ux.vnet.ibm.com>
---
arch/powerpc/kernel/smp.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c
index 27770f7f1ae5..daede8c2abc1 100644
--- a/arch/powerpc/kernel/smp.c
+++ b/arch/powerpc/kernel/smp.c
@@ -1763,6 +1763,19 @@ void __init smp_cpus_done(unsigned int max_cpus)
set_sched_topology(powerpc_topology);
}
+/*
+ * For asym packing, by default lower numbered CPU has higher priority.
+ * On shared processors, pack to lower numbered core. However avoid moving
+ * between thread_groups within the same core.
+ */
+int arch_asym_cpu_priority(int cpu)
+{
+ if (static_branch_unlikely(&splpar_asym_pack))
+ return -cpu / threads_per_core;
+
+ return -cpu;
+}
+
#ifdef CONFIG_HOTPLUG_CPU
int __cpu_disable(void)
{
--
2.31.1
Powered by blists - more mailing lists