From: schspa <schspa@gmail.com>
To: rjw@rjwysocki.net, viresh.kumar@linaro.org
Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
schspa <schspa@gmail.com>
Subject: [PATCH] cpufreq_ondemand: fix bad auto calculated frequency.
Date: Fri, 27 Aug 2021 16:17:53 +0800 [thread overview]
Message-ID: <20210827081752.54337-1-schspa@gmail.com> (raw)
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 <schspa@gmail.com>
---
drivers/cpufreq/cpufreq_ondemand.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/cpufreq/cpufreq_ondemand.c b/drivers/cpufreq/cpufreq_ondemand.c
index ac361a8b1d3b..8afb2c84c38c 100644
--- a/drivers/cpufreq/cpufreq_ondemand.c
+++ b/drivers/cpufreq/cpufreq_ondemand.c
@@ -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 */
--
2.29.0
next reply other threads:[~2021-08-27 8:18 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-27 8:17 schspa [this message]
2021-08-31 4:58 ` [PATCH] cpufreq_ondemand: fix bad auto calculated frequency Viresh Kumar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210827081752.54337-1-schspa@gmail.com \
--to=schspa@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=rjw@rjwysocki.net \
--cc=viresh.kumar@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox