summaryrefslogtreecommitdiff
path: root/arch/arm/kernel
diff options
context:
space:
mode:
authorSrivatsa Vaddagiri <vatsa@codeaurora.org>2014-03-31 19:42:27 -0700
committerPavankumar Kondeti <pkondeti@codeaurora.org>2016-09-30 12:29:08 +0530
commit4ac03df1e16b160b0630c38661eb7fc19e324912 (patch)
tree15ebbc4c607fb437f3e1fcc78120d89fe2060e34 /arch/arm/kernel
parent46692be6dd06ce405cb09cf8338b1f0edbbfb295 (diff)
arm: topology: Define arch_get_cpu_efficiency() API for scheduler
On a HMP system, scheduler needs to know efficiency factor (instructions-per-cycle) for various cpus. This is so that scheduler can estimate bandwidth consumption of tasks on each cpu, based on their efficiency factor. This patch defines arch_get_cpu_efficiency() API in ARM32 architecture. It depends on hard-coded "efficiency" factor for various cpu types (available in 'table_efficiency' data structure) and device-tree providing information on cpu-type for every cpu. Change-Id: I561bace8a813a35a9fc624fca4861c5b1109b69b Signed-off-by: Srivatsa Vaddagiri <vatsa@codeaurora.org> Signed-off-by: Syed Rameez Mustafa <rameezmustafa@codeaurora.org> Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
Diffstat (limited to 'arch/arm/kernel')
-rw-r--r--arch/arm/kernel/topology.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/arch/arm/kernel/topology.c b/arch/arm/kernel/topology.c
index 598323a1842e..9e7ed5c322f4 100644
--- a/arch/arm/kernel/topology.c
+++ b/arch/arm/kernel/topology.c
@@ -190,6 +190,13 @@ static int __init parse_cluster(struct device_node *cluster, int depth)
return 0;
}
+static DEFINE_PER_CPU(unsigned long, cpu_efficiency) = SCHED_CAPACITY_SCALE;
+
+unsigned long arch_get_cpu_efficiency(int cpu)
+{
+ return per_cpu(cpu_efficiency, cpu);
+}
+
#ifdef CONFIG_OF
struct cpu_efficiency {
const char *compatible;
@@ -281,6 +288,8 @@ static int __init parse_dt_topology(void)
if (cpu_eff->compatible == NULL)
continue;
+ per_cpu(cpu_efficiency, cpu) = cpu_eff->efficiency;
+
rate = of_get_property(cn, "clock-frequency", &len);
if (!rate || len != 4) {
pr_err("%s missing clock-frequency property\n",