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

Commit da6833cf authored by Dietmar Eggemann's avatar Dietmar Eggemann Committed by Quentin Perret
Browse files

sched/fair: introduce an arch scaling function for max frequency capping



The max frequency scaling factor is defined as:

  max_freq_scale = policy_max_freq / cpuinfo_max_freq

To be able to scale the cpu capacity by this factor introduce a call to
the new arch scaling function arch_scale_max_freq_capacity() in
update_cpu_capacity() and provide a default implementation which returns
SCHED_CAPACITY_SCALE.

Another subsystem (e.g. cpufreq) can overwrite this default implementation,
exactly as for frequency and cpu invariance. It has to be enabled by the
arch by defining arch_scale_max_freq_capacity to the actual
implementation.

Change-Id: I266cd1f4c1c82f54b80063c36aa5f7662599dd28
Signed-off-by: default avatarDietmar Eggemann <dietmar.eggemann@arm.com>
Signed-off-by: default avatarChris Redpath <chris.redpath@arm.com>
parent 19e1513f
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -8331,6 +8331,9 @@ static void update_cpu_capacity(struct sched_domain *sd, int cpu)

	cpu_rq(cpu)->cpu_capacity_orig = capacity;

	capacity *= arch_scale_max_freq_capacity(sd, cpu);
	capacity >>= SCHED_CAPACITY_SHIFT;

	mcc = &cpu_rq(cpu)->rd->max_cpu_capacity;

	raw_spin_lock_irqsave(&mcc->lock, flags);
+8 −0
Original line number Diff line number Diff line
@@ -1583,6 +1583,14 @@ unsigned long arch_scale_freq_capacity(struct sched_domain *sd, int cpu)
}
#endif

#ifndef arch_scale_max_freq_capacity
static __always_inline
unsigned long arch_scale_max_freq_capacity(struct sched_domain *sd, int cpu)
{
	return SCHED_CAPACITY_SCALE;
}
#endif

#ifndef arch_scale_cpu_capacity
static __always_inline
unsigned long arch_scale_cpu_capacity(struct sched_domain *sd, int cpu)