Messages in this thread | | | Date | Thu, 5 Oct 2023 16:27:46 +0530 | From | Viresh Kumar <> | Subject | Re: [PATCH] cpufreq: conservative: Ensure requested_freq is greater than min frequency |
| |
On 12-09-23, 06:09, Liao Chang wrote: > The governor ensures that the requested frequency is greater than the > minimum frequency when the condition for decreasing frequency is > satisfied. This is done by either reducing the frequency step from the > current frequency if the current frequency is greater than the sum of > the frequency step and the minimum frequency, or setting the frequency > to the minimum one otherwise. > > Signed-off-by: Liao Chang <liaochang1@huawei.com> > --- > drivers/cpufreq/cpufreq_conservative.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/cpufreq/cpufreq_conservative.c b/drivers/cpufreq/cpufreq_conservative.c > index 56500b25d77c..54e09242b2e2 100644 > --- a/drivers/cpufreq/cpufreq_conservative.c > +++ b/drivers/cpufreq/cpufreq_conservative.c > @@ -130,7 +130,7 @@ static unsigned int cs_dbs_update(struct cpufreq_policy *policy) > if (requested_freq == policy->min) > goto out; > > - if (requested_freq > freq_step) > + if (requested_freq > policy->min + freq_step) > requested_freq -= freq_step; > else > requested_freq = policy->min;
I think all we want to ensure here is that we don't end up getting a negative number (since requested_freq is unsigned int, it will end up being a very large freq). __cpufreq_driver_target() will eventually set the freq to policy->min only as we are using CPUFREQ_RELATION_LE here.
-- viresh
| |