arm: Cpu invariant scheduler load-tracking and capacity support
authorDietmar Eggemann <dietmar.eggemann@arm.com>
Fri, 10 Jul 2015 12:57:19 +0000 (13:57 +0100)
committerLeo Yan <leo.yan@linaro.org>
Tue, 10 May 2016 08:49:50 +0000 (16:49 +0800)
Provides the scheduler with a cpu scaling correction factor for more
accurate load-tracking and cpu capacity handling.

The Energy Model (EM) (in fact the capacity value of the last element
of the capacity states vector of the core (MC) level sched_group_energy
structure) is used instead of the arm arch specific cpu_efficiency and
dtb property 'clock-frequency' values as the source for this cpu
scaling factor.

The cpu capacity value depends on the micro-architecture and the
maximum frequency of the cpu.

The maximum frequency part should not be confused with the frequency
invariant scheduler load-tracking support which deals with frequency
related scaling due to DFVS functionality.

Signed-off-by: Juri Lelli <juri.lelli@arm.com>
Signed-off-by: Dietmar Eggemann <dietmar.eggemann@arm.com>
arch/arm/kernel/topology.c

index 38e7be162b7946b0a6324c086833ba5f03d11a76..da1c611a3b5e313e8da0e18b954143f8b4b184ce 100644 (file)
@@ -153,6 +153,8 @@ static void __init parse_dt_topology(void)
 
 }
 
+static const struct sched_group_energy * const cpu_core_energy(int cpu);
+
 /*
  * Look for a customed capacity of a CPU in the cpu_capacity table during the
  * boot. The update of all CPUs is in O(n^2) for heteregeneous system but the
@@ -160,10 +162,14 @@ static void __init parse_dt_topology(void)
  */
 static void update_cpu_capacity(unsigned int cpu)
 {
-       if (!cpu_capacity(cpu))
-               return;
+       unsigned long capacity = SCHED_CAPACITY_SCALE;
+
+       if (cpu_core_energy(cpu)) {
+               int max_cap_idx = cpu_core_energy(cpu)->nr_cap_states - 1;
+               capacity = cpu_core_energy(cpu)->cap_states[max_cap_idx].cap;
+       }
 
-       set_capacity_scale(cpu, cpu_capacity(cpu) / middle_capacity);
+       set_capacity_scale(cpu, capacity);
 
        pr_info("CPU%u: update cpu_capacity %lu\n",
                cpu, arch_scale_cpu_capacity(NULL, cpu));