mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Zeng Heng <zengheng4@huawei.com>
To: Viresh Kumar <viresh.kumar@linaro.org>
Cc: <rafael@kernel.org>, <liwei391@huawei.com>,
	<linux-pm@vger.kernel.org>, <xiexiuqi@huawei.com>,
	<wangxiongfeng2@huawei.com>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH -next] cpufreq: userspace: Keep the current frequency when set userspace policy
Date: Thu, 26 Oct 2023 10:36:15 +0800	[thread overview]
Message-ID: <1369cedf-e66b-82eb-4501-a6976bb8c558@huawei.com> (raw)
In-Reply-To: <20231025111821.pp3hdpilddbx4yzr@vireshk-i7>


在 2023/10/25 19:18, Viresh Kumar 写道:
> On 25-10-23, 16:09, Zeng Heng wrote:
>> When switching to the userspace policy, if the current frequency is within
>> the range of policy's min and max values, the current frequency value
>> should be remained. The .limit() function is called when changing governor
>> or updating governor limits, so in both cases, there is no need to update
>> frequency if the current frequency does not exceed the threshold.
>>
>> Additionally, when changing to userspace governor, the default value of
>> set_speed is set by reading the current frequency of the CPU, but there
>> is inevitable error between the frequency coming from .get_rate() interface
>> and the actual working frequency. Consequently, when switching to userspace
>> policy, keeping the current frequency can avoid unexpected changes.
>>
>> Signed-off-by: Zeng Heng <zengheng4@huawei.com>
>> ---
>>   drivers/cpufreq/cpufreq_userspace.c | 4 +---
>>   1 file changed, 1 insertion(+), 3 deletions(-)
>>
>> diff --git a/drivers/cpufreq/cpufreq_userspace.c b/drivers/cpufreq/cpufreq_userspace.c
>> index 2c42fee76daa..fe55a7bb663c 100644
>> --- a/drivers/cpufreq/cpufreq_userspace.c
>> +++ b/drivers/cpufreq/cpufreq_userspace.c
>> @@ -117,9 +117,7 @@ static void cpufreq_userspace_policy_limits(struct cpufreq_policy *policy)
>>   	else if (policy->min > userspace->setspeed)
>>   		__cpufreq_driver_target(policy, policy->min,
>>   					CPUFREQ_RELATION_L);
>> -	else
>> -		__cpufreq_driver_target(policy, userspace->setspeed,
>> -					CPUFREQ_RELATION_L);
>> +	/* Otherwise, keep the current frequency. */
>>
>>   	mutex_unlock(&userspace->mutex);
>>   }
> Here is some reasoning why it should be done the way it is:
>
> commit e43e94c1eda7 ("cpufreq: Fix GOV_LIMITS handling for the userspace governor")


Get it, thanks for the response.

Zeng Heng


      reply	other threads:[~2023-10-26  2:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-25  8:09 Zeng Heng
2023-10-25 11:18 ` Viresh Kumar
2023-10-26  2:36   ` Zeng Heng [this message]

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=1369cedf-e66b-82eb-4501-a6976bb8c558@huawei.com \
    --to=zengheng4@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=liwei391@huawei.com \
    --cc=rafael@kernel.org \
    --cc=viresh.kumar@linaro.org \
    --cc=wangxiongfeng2@huawei.com \
    --cc=xiexiuqi@huawei.com \
    /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

all inboxes | Powered by JetHome®