cpufreq_ondemand: fix bad auto calculated frequency.
PATCH 1/1 cpufreq_ondemand: fix bad auto calculated frequency.
We can litmit cpufreq range by change min & max from cpufreq_policy. So cpu frequency target should be in range [policy->min, policy->max].
Signed-off-by schspa <[email protected]>
--- drivers/cpufreq/cpufreq_ondemand.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/cpufreq/cpufreq_ondemand.c +2 -2
@@ -151,8 +151,8 @@ static void od_update(struct cpufreq_policy *policy)/* Calculate the next frequency proportional to load */ unsigned int freq_next, min_f, max_f; - min_f = policy->cpuinfo.min_freq; - max_f = policy->cpuinfo.max_freq; + min_f = policy->min; + max_f = policy->max; freq_next = min_f + load * (max_f - min_f) /100 ;/* No longer fully busy, reset rate_mult */
Signature · 1 line
2.29.0
Viresh Kumar
maintainerQuoted 13 lines · schspa
We can litmit cpufreq range by change min & max from
cpufreq_policy. So cpu frequency target should be in range [policy->min,policy->max].Signed-off-by schspa <[email protected]>--- drivers/cpufreq/cpufreq_ondemand.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/cpufreq/cpufreq_ondemand.c +0
-0
drivers/cpufreq/cpufreq_ondemand.c static void od_update(struct cpufreq_policy *policy) · line 156
Quoted 8 lines
drivers/cpufreq/cpufreq_ondemand.c +2
-2@@ -151,8 +151,8 @@ static void od_update(struct cpufreq_policy *policy)/* Calculate the next frequency proportional to load */ unsigned int freq_next, min_f, max_f; - min_f = policy->cpuinfo.min_freq; - max_f = policy->cpuinfo.max_freq; + min_f = policy->min; + max_f = policy->max; freq_next = min_f + load * (max_f - min_f) /100 ;
No. The current calculations are right. The new frequency is proportional to current load and it needs to take into account the entire freq range of the CPUs. Note that we will eventually try to get the resultant frequency within policy->min/max range in __cpufreq_driver_target().
Signature · 1 line
viresh