From: "zhenglifeng (A)" <zhenglifeng1@huawei.com>
To: Viresh Kumar <viresh.kumar@linaro.org>,
Zhongqiu Han <zhongqiu.han@oss.qualcomm.com>
Cc: <rafael@kernel.org>, <stratosk@semaphore.gr>,
<linux-pm@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<linuxarm@huawei.com>, <zhanjie9@hisilicon.com>,
<lihuisong@huawei.com>, <yubowen8@huawei.com>,
<zhangpengjie2@huawei.com>, <wangzhi12@huawei.com>,
<linhongye@h-partners.com>
Subject: Re: [PATCH] cpufreq: conservative: Fix incorrect frequency decrease due to stale target
Date: Wed, 20 May 2026 16:22:17 +0800 [thread overview]
Message-ID: <fc82e05b-db8b-4a15-b46d-332c9f2d95da@huawei.com> (raw)
In-Reply-To: <5ivkhopr53lsrnlu62ucdn5yfyeh42nwq3knfifp4ihgv6kpzy@sd6eekl2r45a>
On 5/20/2026 3:48 PM, Viresh Kumar wrote:
> On 11-05-26, 12:03, Zhongqiu Han wrote:
>> Just one small concern is that requested_freq may underflow as an
>> unsigned value; perhaps this could be improved by:
>>
>> - if (requested_freq > freq_step)
>> + if (requested_freq > policy->min + freq_step)
>> requested_freq -= freq_step;
>> else
>> requested_freq = policy->min;
>
> Looks fine.
>
>> or use min() func?
>>
>> Additionally, it seems that dropping the early‑exit checks also appears
>> to be a nice side effect fix for CPUFREQ_NEED_UPDATE_LIMITS drivers when
>> updating internal upper and lower frequency boundaries.
>>
>> As designed in commit 1c534352f47f ("cpufreq: Introduce
>> CPUFREQ_NEED_UPDATE_LIMITS driver flag"), a cpufreq driver may need to
>> update its internal frequency limits when policy min or max changes for
>> drivers setting CPUFREQ_NEED_UPDATE_LIMITS.
>>
>> However, the early‑exit in cs_dbs_update() can prevent
>> __cpufreq_driver_target() from ever being called.
>>
>> For example, when policy->min rises from 200 to 400 kHz while policy
>> ->cur is already at 400 kHz, under low load:
>>
>> cpufreq_policy_apply_limits():
>> policy->min(400) > policy->cur(400) ? NO -> driver not called
>>
>> cs_limits():
>> dbs_info->requested_freq = policy->cur = 400
>>
>> [next sampling period, low load]
>> cs_dbs_update():
>> requested_freq = 400
>> if (requested_freq == policy->min) /* 400 == 400 -> true */
>> goto out; /* __cpufreq_driver_target() never called */
>>
>> With the early‑exit removed, __cpufreq_driver_target() is called with
>> target == policy->cur, and CPUFREQ_NEED_UPDATE_LIMITS ensures the driver
>> is invoked to update its internal performance boundaries.
>
> I think we are all in agreement on this now ?
>
For CPUFREQ_NEED_UPDATE_LIMITS drivers, dropping this early-exit checks
means cpufreq_driver->target() will always be called every time when
cs_dbs_update() is called. Is it OK?
next prev parent reply other threads:[~2026-05-20 8:22 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-21 12:35 Lifeng Zheng
2026-04-22 8:06 ` Stratos Karafotis
2026-04-22 8:36 ` zhenglifeng (A)
2026-04-23 5:39 ` Zhongqiu Han
2026-04-23 7:12 ` zhenglifeng (A)
2026-05-07 9:33 ` Viresh Kumar
2026-05-08 6:46 ` Zhongqiu Han
2026-05-08 10:14 ` Viresh Kumar
2026-05-09 2:01 ` zhenglifeng (A)
2026-05-11 4:03 ` Zhongqiu Han
2026-05-20 7:48 ` Viresh Kumar
2026-05-20 8:04 ` Zhongqiu Han
2026-05-20 8:19 ` Viresh Kumar
2026-05-20 8:22 ` zhenglifeng (A) [this message]
2026-05-20 9:57 ` Viresh Kumar
2026-05-20 11:16 ` Rafael J. Wysocki
2026-05-21 11:41 ` Viresh Kumar
2026-05-09 1:54 ` zhenglifeng (A)
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=fc82e05b-db8b-4a15-b46d-332c9f2d95da@huawei.com \
--to=zhenglifeng1@huawei.com \
--cc=lihuisong@huawei.com \
--cc=linhongye@h-partners.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=linuxarm@huawei.com \
--cc=rafael@kernel.org \
--cc=stratosk@semaphore.gr \
--cc=viresh.kumar@linaro.org \
--cc=wangzhi12@huawei.com \
--cc=yubowen8@huawei.com \
--cc=zhangpengjie2@huawei.com \
--cc=zhanjie9@hisilicon.com \
--cc=zhongqiu.han@oss.qualcomm.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®