This commit sets the power of the average CPU in SMP systems to SCHED_CAPACITY_SCALE.
Ignoring the condition "min_capacity==max_capacity" causes the function update_cpu_power( .. ) to generate out of range values. This is because the default value of middle_capacity is used in the final calculation instead of a valid scaling factor.
Incidentally, when out of range values are generated and if SCHED_FEAT(ARCH_POWER) is true, the load balancing algorithm makes incorrect scheduling decisions typically overallocating all the work on one of the CPU cores.
This proposed solution to arm64 is in line with the upstream solution present in arm32 since the commit below was merged:
* SHA: 816a8de0017f16c32e747abc5367bf379515b20a * From: Sudeep KarkadaNagesha sudeep.karkadanagesha@arm.com * Date: Mon, 17 Jun 2013 14:20:00 +0100 * Subject: ARM: topology: remove hwid/MPIDR dependency from cpu_capac
Signed-off-by: Jorge Ramirez-Ortiz jorge.ramirez-ortiz@linaro.org --- arch/arm64/kernel/topology.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/arch/arm64/kernel/topology.c b/arch/arm64/kernel/topology.c index db8bb29..31e3e6e 100644 --- a/arch/arm64/kernel/topology.c +++ b/arch/arm64/kernel/topology.c @@ -317,16 +317,12 @@ static void __init parse_dt_cpu_power(void) cpu_capacity(cpu) = capacity; }
- /* If min and max capacities are equal we bypass the update of the - * cpu_scale because all CPUs have the same capacity. Otherwise, we - * compute a middle_capacity factor that will ensure that the capacity + /* compute a middle_capacity factor that will ensure that the capacity * of an 'average' CPU of the system will be as close as possible to * SCHED_POWER_SCALE, which is the default value, but with the * constraint explained near table_efficiency[]. */ - if (min_capacity == max_capacity) - return; - else if (4 * max_capacity < (3 * (max_capacity + min_capacity))) + if (4 * max_capacity < (3 * (max_capacity + min_capacity))) middle_capacity = (min_capacity + max_capacity) >> (SCHED_POWER_SHIFT+1); else
On 26 May 2015 at 01:46, Jorge Ramirez-Ortiz jorge.ramirez-ortiz@linaro.org wrote:
This commit sets the power of the average CPU in SMP systems to SCHED_CAPACITY_SCALE.
Ignoring the condition "min_capacity==max_capacity" causes the function update_cpu_power( .. ) to generate out of range values. This is because the default value of middle_capacity is used in the final calculation instead of a valid scaling factor.
Incidentally, when out of range values are generated and if SCHED_FEAT(ARCH_POWER) is true, the load balancing algorithm makes incorrect scheduling decisions typically overallocating all the work on one of the CPU cores.
This proposed solution to arm64 is in line with the upstream solution present in arm32 since the commit below was merged:
- SHA: 816a8de0017f16c32e747abc5367bf379515b20a
- From: Sudeep KarkadaNagesha sudeep.karkadanagesha@arm.com
- Date: Mon, 17 Jun 2013 14:20:00 +0100
- Subject: ARM: topology: remove hwid/MPIDR dependency from cpu_capac
Signed-off-by: Jorge Ramirez-Ortiz jorge.ramirez-ortiz@linaro.org
arch/arm64/kernel/topology.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/arch/arm64/kernel/topology.c b/arch/arm64/kernel/topology.c index db8bb29..31e3e6e 100644 --- a/arch/arm64/kernel/topology.c +++ b/arch/arm64/kernel/topology.c @@ -317,16 +317,12 @@ static void __init parse_dt_cpu_power(void) cpu_capacity(cpu) = capacity; }
/* If min and max capacities are equal we bypass the update of the
* cpu_scale because all CPUs have the same capacity. Otherwise, we
* compute a middle_capacity factor that will ensure that the capacity
/* compute a middle_capacity factor that will ensure that the capacity * of an 'average' CPU of the system will be as close as possible to * SCHED_POWER_SCALE, which is the default value, but with the * constraint explained near table_efficiency[]. */
if (min_capacity == max_capacity)
return;
else if (4 * max_capacity < (3 * (max_capacity + min_capacity)))
if (4 * max_capacity < (3 * (max_capacity + min_capacity))) middle_capacity = (min_capacity + max_capacity) >> (SCHED_POWER_SHIFT+1); else
FWIW, you can add my Acked-by
-- 2.1.4
Jorge Ramirez-Ortiz jorge.ramirez-ortiz@linaro.org writes:
This commit sets the power of the average CPU in SMP systems to SCHED_CAPACITY_SCALE.
Ignoring the condition "min_capacity==max_capacity" causes the function update_cpu_power( .. ) to generate out of range values. This is because the default value of middle_capacity is used in the final calculation instead of a valid scaling factor.
Incidentally, when out of range values are generated and if SCHED_FEAT(ARCH_POWER) is true, the load balancing algorithm makes incorrect scheduling decisions typically overallocating all the work on one of the CPU cores.
This proposed solution to arm64 is in line with the upstream solution present in arm32 since the commit below was merged:
- SHA: 816a8de0017f16c32e747abc5367bf379515b20a
- From: Sudeep KarkadaNagesha sudeep.karkadanagesha@arm.com
- Date: Mon, 17 Jun 2013 14:20:00 +0100
- Subject: ARM: topology: remove hwid/MPIDR dependency from cpu_capac
Signed-off-by: Jorge Ramirez-Ortiz jorge.ramirez-ortiz@linaro.org
With ack from Vincent, applied to LSK v3.10 topic branch v3.10/topic/arm64-hmp and merged into linux-linaro-lsk-v3.10
Thanks,
Kevin
linaro-kernel@lists.linaro.org