Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b4ca4bcf authored by Dietmar Eggemann's avatar Dietmar Eggemann Committed by Dmitry Shmidt
Browse files

ANDROID: arm: Cpu invariant scheduler load-tracking and capacity support



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: default avatarJuri Lelli <juri.lelli@arm.com>
Signed-off-by: default avatarDietmar Eggemann <dietmar.eggemann@arm.com>
Signed-off-by: default avatarAndres Oportus <andresoportus@google.com>
parent 858d7188
Loading
Loading
Loading
Loading
+9 −3
Original line number Original line Diff line number Diff line
@@ -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
 * 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
 * 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)
static void update_cpu_capacity(unsigned int cpu)
{
{
	if (!cpu_capacity(cpu))
	unsigned long capacity = SCHED_CAPACITY_SCALE;
		return;

	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",
	pr_info("CPU%u: update cpu_capacity %lu\n",
		cpu, arch_scale_cpu_capacity(NULL, cpu));
		cpu, arch_scale_cpu_capacity(NULL, cpu));