Re: [PATCH] cpufreq: conservative: Fix incorrect frequency decrease due to stale target
From: zhenglifeng (A)
Date: Fri May 08 2026 - 21:56:40 EST
On 5/7/2026 5:33 PM, Viresh Kumar wrote:
> On 23-04-26, 15:12, zhenglifeng (A) wrote:
>> Yes, I think you are right. The behaviors are not the same. I modified this
>> just in order to keep it consistent with the case exceeding down_threshold.
>> I'm not sure if this change of behavior is reasonable. Perhaps Rafael or
>> Viresh could give us some advice.
>
>>>> diff --git a/drivers/cpufreq/cpufreq_conservative.c b/drivers/cpufreq/cpufreq_conservative.c
>>>> @@ -104,7 +104,7 @@ static unsigned int cs_dbs_update(struct cpufreq_policy *policy)
>>>> dbs_info->down_skip = 0;
>>>> /* if we are already at full speed then break out early */
>>>> - if (requested_freq == policy->max)
>>>> + if (dbs_info->requested_freq == policy->max)
>>>> goto out;
>
>>>> - if (requested_freq == policy->min)
>>>> + if (dbs_info->requested_freq == policy->min)
>
> What about dropping these `if` blocks completely ? i.e. always call
> __cpufreq_driver_target().
>
> __cpufreq_driver_target() already have similar checks in place to optimize
> unnecessary freq changes. We don't really need callers to do the same.
>
__cpufreq_driver_target() only skips this when !(cpufreq_driver->flags & CPUFREQ_NEED_UPDATE_LIMITS),
this means that for cppc_cpufreq, amd-pstate and intel_pstate the
unnecessary freq change will still be called.