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

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

cpufreq: remove max frequency capping from scale_freq_capacity()



After the revert of "cpufreq: Max freq invariant scheduler load-tracking
and cpu capacity support" scale_freq_capacity() is now only the setter
of the Frequency Invariant Engine (FIE). That's why the call to
scale_freq_capacity() in cpufreq_set_policy() can be deleted because
this was driving max frequency capping.

The patch changes the parameter list of scale_freq_capacity() to

 (1) set of cpus involved (cpumask)
 (2) current frequency
 (3) max possible frequency (cpuinfo related)

to not be forced to expose cpufreq internal data structures like struct
cpufreq_policy or struct cpufreq_freqs.

Change-Id: I4a8d319d2d01854409f55ab058cb5a15ed9faf9a
Signed-off-by: default avatarDietmar Eggemann <dietmar.eggemann@arm.com>
Signed-off-by: default avatarChris Redpath <chris.redpath@arm.com>
parent 85f139e7
Loading
Loading
Loading
Loading
+8 −10
Original line number Diff line number Diff line
@@ -317,17 +317,17 @@ static void adjust_jiffies(unsigned long val, struct cpufreq_freqs *ci)
static DEFINE_PER_CPU(unsigned long, freq_scale) = SCHED_CAPACITY_SCALE;

static void
scale_freq_capacity(struct cpufreq_policy *policy, struct cpufreq_freqs *freqs)
scale_freq_capacity(const cpumask_t *cpus, unsigned long cur_freq,
		    unsigned long max_freq)
{
	unsigned long cur = freqs ? freqs->new : policy->cur;
	unsigned long scale = (cur << SCHED_CAPACITY_SHIFT) / policy->max;
	unsigned long scale = (cur_freq << SCHED_CAPACITY_SHIFT) / max_freq;
	int cpu;

	pr_debug("cpus %*pbl cur/cur max freq %lu/%u kHz freq scale %lu\n",
		 cpumask_pr_args(policy->cpus), cur, policy->max, scale);

	for_each_cpu(cpu, policy->cpus)
	for_each_cpu(cpu, cpus)
		per_cpu(freq_scale, cpu) = scale;

	pr_debug("cpus %*pbl cur freq/max freq %lu/%lu kHz freq scale %lu\n",
		 cpumask_pr_args(cpus), cur_freq, max_freq, scale);
}

unsigned long cpufreq_scale_freq_capacity(struct sched_domain *sd, int cpu)
@@ -442,7 +442,7 @@ void cpufreq_freq_transition_begin(struct cpufreq_policy *policy,

	spin_unlock(&policy->transition_lock);

	scale_freq_capacity(policy, freqs);
	scale_freq_capacity(policy->cpus, freqs->new, policy->cpuinfo.max_freq);
#ifdef CONFIG_SMP
	for_each_cpu(cpu, policy->cpus)
		trace_cpu_capacity(capacity_curr_of(cpu), cpu);
@@ -2238,8 +2238,6 @@ static int cpufreq_set_policy(struct cpufreq_policy *policy,
	blocking_notifier_call_chain(&cpufreq_policy_notifier_list,
			CPUFREQ_NOTIFY, new_policy);

	scale_freq_capacity(new_policy, NULL);

	policy->min = new_policy->min;
	policy->max = new_policy->max;
	trace_cpu_frequency_limits(policy->max, policy->min, policy->cpu);