Skip to content

Commit 79afe6e

Browse files
credppundiramit
authored andcommitted
cpufreq/sched: Use cpu max freq rather than policy max
When we convert capacity into frequency, we used policy->max to get the max freq of the cpu. Since this can be changed by userspace policy or thermal events, we are potentially asking for a lower frequency than the utilization demands. Change over to using cpuinfo.max which is the max freq supported by that cpu rather than the currently-chosen max. Frequency granted still honours the max policy. Tested by setting a userspace policy and observing the relevant vars in a trace. In this instance, we ask for around 1ghz instead of 620MHz. freq_new=1013512 unfixed_freq_new=624487 capacity=546 cpuinfo_max=1900800 policy_max=1171200 Change-Id: I8c5694db42243c6fb78bb9be9046b06ac81295e7 Signed-off-by: Chris Redpath <chris.redpath@arm.com>
1 parent 6f8b7ac commit 79afe6e

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

kernel/sched/cpufreq_sched.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ static void update_fdomain_capacity_request(int cpu)
202202
}
203203

204204
/* Convert the new maximum capacity request into a cpu frequency */
205-
freq_new = capacity * policy->max >> SCHED_CAPACITY_SHIFT;
205+
freq_new = capacity * policy->cpuinfo.max_freq >> SCHED_CAPACITY_SHIFT;
206206
if (cpufreq_frequency_table_target(policy, policy->freq_table,
207207
freq_new, CPUFREQ_RELATION_L,
208208
&index_new))

0 commit comments

Comments
 (0)