Skip to content
This repository was archived by the owner on Jul 3, 2019. It is now read-only.

Commit

Permalink
LINARO: arm64: topology: fix cpu power calculation
Browse files Browse the repository at this point in the history
From: https://git.linaro.org/kernel/linux-linaro-stable.git/commit/?id=646fe96c67a5fcc2cfffb7326b2299f2714f7f27

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: 816a8de
* From: Sudeep KarkadaNagesha <[email protected]>
* 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 <[email protected]>
Acked-by: Vincent Guittot <[email protected]>
Signed-off-by: Kevin Hilman <[email protected]>
Signed-off-by: Nathan Chancellor <[email protected]>
  • Loading branch information
ldts authored and nathanchance committed Jan 17, 2018
1 parent 09046d0 commit 1032900
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions arch/arm64/kernel/topology.c
Original file line number Diff line number Diff line change
Expand Up @@ -350,16 +350,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_CAPACITY_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_CAPACITY_SHIFT+1);
else
Expand Down

0 comments on commit 1032900

Please sign in to comment.