From: Vincent Guittot <vincent.guittot@linaro.org>
To: linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, linaro-dev@lists.linaro.org,
devicetree-discuss@lists.ozlabs.org
Cc: linux@arm.linux.org.uk, a.p.zijlstra@chello.nl,
grant.likely@secretlab.ca, rob.herring@calxeda.com,
yong.zhang0@gmail.com, namhyung@kernel.org,
jean.pihet@newoldbits.com,
Vincent Guittot <vincent.guittot@linaro.org>
Subject: [PATCH v4 1/5] ARM: topology: Add arch_scale_freq_power function
Date: Mon, 9 Jul 2012 11:27:02 +0200 [thread overview]
Message-ID: <1341826026-6504-2-git-send-email-vincent.guittot@linaro.org> (raw)
In-Reply-To: <1341826026-6504-1-git-send-email-vincent.guittot@linaro.org>
Add infrastructure to be able to modify the cpu_power of each core
Signed-off-by: Vincent Guittot <vincent.guittot@linaro.org>
Reviewed-by: Namhyung Kim <namhyung@kernel.org>
---
arch/arm/kernel/topology.c | 38 +++++++++++++++++++++++++++++++++++++-
1 file changed, 37 insertions(+), 1 deletion(-)
diff --git a/arch/arm/kernel/topology.c b/arch/arm/kernel/topology.c
index 8200dea..51f23b3 100644
--- a/arch/arm/kernel/topology.c
+++ b/arch/arm/kernel/topology.c
@@ -22,6 +22,37 @@
#include <asm/cputype.h>
#include <asm/topology.h>
+/*
+ * cpu power scale management
+ */
+
+/*
+ * cpu power table
+ * This per cpu data structure describes the relative capacity of each core.
+ * On a heteregenous system, cores don't have the same computation capacity
+ * and we reflect that difference in the cpu_power field so the scheduler can
+ * take this difference into account during load balance. A per cpu structure
+ * is preferred because each CPU updates its own cpu_power field during the
+ * load balance except for idle cores. One idle core is selected to run the
+ * rebalance_domains for all idle cores and the cpu_power can be updated
+ * during this sequence.
+ */
+static DEFINE_PER_CPU(unsigned long, cpu_scale);
+
+unsigned long arch_scale_freq_power(struct sched_domain *sd, int cpu)
+{
+ return per_cpu(cpu_scale, cpu);
+}
+
+static void set_power_scale(unsigned int cpu, unsigned long power)
+{
+ per_cpu(cpu_scale, cpu) = power;
+}
+
+/*
+ * cpu topology management
+ */
+
#define MPIDR_SMP_BITMASK (0x3 << 30)
#define MPIDR_SMP_VALUE (0x2 << 30)
@@ -41,6 +72,9 @@
#define MPIDR_LEVEL2_MASK 0xFF
#define MPIDR_LEVEL2_SHIFT 16
+/*
+ * cpu topology table
+ */
struct cputopo_arm cpu_topology[NR_CPUS];
const struct cpumask *cpu_coregroup_mask(int cpu)
@@ -134,7 +168,7 @@ void init_cpu_topology(void)
{
unsigned int cpu;
- /* init core mask */
+ /* init core mask and power*/
for_each_possible_cpu(cpu) {
struct cputopo_arm *cpu_topo = &(cpu_topology[cpu]);
@@ -143,6 +177,8 @@ void init_cpu_topology(void)
cpu_topo->socket_id = -1;
cpumask_clear(&cpu_topo->core_sibling);
cpumask_clear(&cpu_topo->thread_sibling);
+
+ set_power_scale(cpu, SCHED_POWER_SCALE);
}
smp_wmb();
}
--
1.7.9.5
next prev parent reply other threads:[~2012-07-09 9:27 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-09 9:27 [PATCH v4 0/5] ARM: topology: set the capacity of each cores for big.LITTLE Vincent Guittot
2012-07-09 9:27 ` Vincent Guittot [this message]
[not found] ` <1341826026-6504-1-git-send-email-vincent.guittot-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2012-07-09 9:27 ` [PATCH v4 2/5] ARM: topology: factorize the update of sibling masks Vincent Guittot
2012-07-09 9:27 ` [PATCH v4 3/5] ARM: topology: Update cpu_power according to DT information Vincent Guittot
2012-07-09 10:55 ` Shilimkar, Santosh
2012-07-09 11:00 ` Peter Zijlstra
2012-07-09 11:04 ` Shilimkar, Santosh
[not found] ` <CAMQu2gydOEVK_fzmzkdrBwBfOq6eZG=0QfLUfFChWJu9unSn2A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-07-09 12:32 ` Vincent Guittot
2012-07-09 13:00 ` Shilimkar, Santosh
2012-07-09 14:36 ` Vincent Guittot
[not found] ` <CAKfTPtCicLseyA4DnUwNWf7+jOmab4KLo8Yw=Rz1KPya+fE_-w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-07-09 14:37 ` Shilimkar, Santosh
2012-07-09 15:10 ` Vincent Guittot
[not found] ` <CAKfTPtCcxg5PNqjXrz9zYwE-DDAUtdbaUuuGpGqGzOFZrk3rnw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-07-09 15:28 ` Shilimkar, Santosh
[not found] ` <1341826026-6504-4-git-send-email-vincent.guittot-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2012-09-13 13:03 ` Dave Martin
2012-07-09 9:27 ` [PATCH v4 4/5] sched, x86: Remove broken power estimation Vincent Guittot
2012-07-09 9:27 ` [PATCH v4 5/5] sched: cpu_power: enable ARCH_POWER Vincent Guittot
2012-07-10 11:27 ` [PATCH v4 0/5] ARM: topology: set the capacity of each cores for big.LITTLE Peter Zijlstra
2012-07-10 12:35 ` Vincent Guittot
[not found] ` <CAKfTPtC0BcidJ2ga9c2fdWjrEsfXH48QtSnjv0YOCv7-k3K-Ug-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-07-10 13:42 ` Peter Zijlstra
2012-09-13 9:17 ` Vincent Guittot
[not found] ` <CAKfTPtCpZS=ALAjwqX5Wb0j5HjrMjv87MEefGC2O5_p7ENeY2w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-09-13 12:07 ` Peter Zijlstra
2012-09-13 12:51 ` Vincent Guittot
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=1341826026-6504-2-git-send-email-vincent.guittot@linaro.org \
--to=vincent.guittot@linaro.org \
--cc=a.p.zijlstra@chello.nl \
--cc=devicetree-discuss@lists.ozlabs.org \
--cc=grant.likely@secretlab.ca \
--cc=jean.pihet@newoldbits.com \
--cc=linaro-dev@lists.linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@arm.linux.org.uk \
--cc=namhyung@kernel.org \
--cc=rob.herring@calxeda.com \
--cc=yong.zhang0@gmail.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).