From: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
To: Michael Ellerman <mpe@ellerman.id.au>,
Nicholas Piggin <npiggin@gmail.com>,
Christophe Leroy <christophe.leroy@csgroup.eu>
Cc: Mark Rutland <mark.rutland@arm.com>,
Valentin Schneider <vschneid@redhat.com>,
Vincent Guittot <vincent.guittot@linaro.org>,
Srikar Dronamraju <srikar@linux.vnet.ibm.com>,
"Paul E. McKenney" <paulmck@kernel.org>,
Peter Zijlstra <peterz@infradead.org>,
"ndesaulniers@google.com" <ndesaulniers@google.com>,
linux-kernel@vger.kernel.org, Aneesh <aneesh.kumar@kernel.org>,
Rohan McLure <rmclure@linux.ibm.com>,
linuxppc-dev <linuxppc-dev@lists.ozlabs.org>,
Josh Poimboeuf <jpoimboe@kernel.org>
Subject: [PATCH v5 4/5] powerpc/smp: Avoid asym packing within thread_group of a core
Date: Thu, 14 Dec 2023 23:37:14 +0530 [thread overview]
Message-ID: <20231214180720.310852-5-srikar@linux.vnet.ibm.com> (raw)
In-Reply-To: <20231214180720.310852-1-srikar@linux.vnet.ibm.com>
PowerVM Hypervisor will schedule at a core granularity. However each
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@linux.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 aea149627209..9d8bb9a084bd 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.35.3
next prev parent reply other threads:[~2023-12-14 18:12 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-14 18:07 [PATCH v5 0/5] powerpc/smp: Topology and shared processor optimizations Srikar Dronamraju
2023-12-14 18:07 ` [PATCH v5 1/5] powerpc/smp: Enable Asym packing for cores on shared processor Srikar Dronamraju
2023-12-15 5:01 ` Aneesh Kumar K.V
2023-12-14 18:07 ` [PATCH v5 2/5] powerpc/smp: Disable MC domain for " Srikar Dronamraju
2023-12-14 18:07 ` [PATCH v5 3/5] powerpc/smp: Add __ro_after_init attribute Srikar Dronamraju
2023-12-14 18:07 ` Srikar Dronamraju [this message]
2023-12-14 18:07 ` [PATCH v5 5/5] powerpc/smp: Dynamically build Powerpc topology Srikar Dronamraju
2023-12-21 10:38 ` [PATCH v5 0/5] powerpc/smp: Topology and shared processor optimizations Michael Ellerman
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=20231214180720.310852-5-srikar@linux.vnet.ibm.com \
--to=srikar@linux.vnet.ibm.com \
--cc=aneesh.kumar@kernel.org \
--cc=christophe.leroy@csgroup.eu \
--cc=jpoimboe@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mark.rutland@arm.com \
--cc=mpe@ellerman.id.au \
--cc=ndesaulniers@google.com \
--cc=npiggin@gmail.com \
--cc=paulmck@kernel.org \
--cc=peterz@infradead.org \
--cc=rmclure@linux.ibm.com \
--cc=vincent.guittot@linaro.org \
--cc=vschneid@redhat.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;
as well as URLs for NNTP newsgroup(s).