mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sibi Sankar <sibi.sankar@oss.qualcomm.com>
To: Vincent Guittot <vincent.guittot@linaro.org>
Cc: rafael@kernel.org, viresh.kumar@linaro.org, mingo@redhat.com,
	peterz@infradead.org, linux-arm-msm@vger.kernel.org,
	juri.lelli@redhat.com, dietmar.eggemann@arm.com,
	linux-kernel@vger.kernel.org, rostedt@goodmis.org,
	bsegall@google.com, mgorman@suse.de, vschneid@redhat.com,
	kprateek.nayak@amd.com, linux-pm@vger.kernel.org
Subject: Re: [PATCH 2/2] sched/cpufreq: Update schedutil's DVFS request to reach the boost frequencies
Date: Fri, 7 Aug 2026 20:02:52 +0530	[thread overview]
Message-ID: <c1f9c858-f14a-405e-97ad-0c1748b7c5a1@oss.qualcomm.com> (raw)
In-Reply-To: <CAKfTPtDQ+843t5fgknAMcfkYP_ZLxxYU8D+KJtx8QzMy=qMoCQ@mail.gmail.com>


On 8/6/2026 8:39 PM, Vincent Guittot wrote:
> On Thu, 6 Aug 2026 at 06:42, Sibi Sankar <sibi.sankar@oss.qualcomm.com> wrote:
>> capacity_freq_ref, exposed to schedutil via get_capacity_ref_freq(),
>> was introduced by commit 9942cb22ea45 ("sched/topology: Add a new
>> arch_scale_freq_ref() method") as a fixed anchor that does not move at
>> runtime. However, schedutil uses that same fixed anchor as the reference
>> plugged into map_util_freq() which saturates exactly at capacity_freq_ref.
>>
>> As a result, a system with cpufreq boost enabled effectively never runs at
>> boost frequencies under schedutil-governed load. Fix this by plugging in
>> policy-max into the map_util_freq equation, so that the DVFS requests
>> translates to the actual cpufreq driver ceiling.
>>
>> Signed-off-by: Sibi Sankar <sibi.sankar@oss.qualcomm.com>
>> ---
>>   kernel/sched/cpufreq_schedutil.c | 13 ++++++++++---
>>   1 file changed, 10 insertions(+), 3 deletions(-)
>>
>> diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c
>> index a1782755efcc..dcefbeaa0702 100644
>> --- a/kernel/sched/cpufreq_schedutil.c
>> +++ b/kernel/sched/cpufreq_schedutil.c
>> @@ -195,10 +195,17 @@ static unsigned int get_next_freq(struct sugov_policy *sg_policy,
>>                                    unsigned long util, unsigned long max)
>>   {
>>          struct cpufreq_policy *policy = sg_policy->policy;
>> -       unsigned int freq;
>> +       unsigned int freq, ref;
>>
>> -       freq = get_capacity_ref_freq(policy);
>> -       freq = map_util_freq(util, freq, max);
>> +       ref = get_capacity_ref_freq(policy);
>> +
>> +       /*
>> +        * That fixed anchor governs how utilization is interpreted, but
>> +        * the DVFS request is free to target the current policy ceiling.
>> +        * Using ref alone would saturate the util->freq map at ref so
>> +        * use policy->max to reach boost frequencies.
>> +        */
>> +       freq = map_util_freq(util, max(ref, READ_ONCE(policy->max)), max);
> But this is wrong because arch_scale_freq_ref is the freq that has
> been used when setting the capacity of the cpu and is there to make
> sure that the translation between freq <-> capacity is correct and
> consistent whatever happens later on the freq table of cpufreq. This
> ensures that utilization tracking remains correct vs other CPUS and
> prevents or minimizes utilization oscillation, which triggers other
> problems
>
> Either we enable the utilization value to go above CPU's capacity when
> we transmit it to cpufreq (and above SCHED_CAPACITY_SCALE which could
> trigger a number of problem while computing pelt)
> Or, you take into account the boost freq when setting cpu's capacity
> and associated capacity_freq_ref at boot even if not enabled. With
> cpufreq pressure feature and the policy->max (not  cpuinfo_max_freq)
> correctly updated with a freq_qos_update_request when boost is
> enabled/disabled, the scheduler and pelt should handle that correctly
> as we normaly take into account cpufreq_pressure everywhere in
> scheduler.

Thanks for your inputs! Ack, will try out the latter since it appears to 
be the
right way to address this.

>
>>          if (freq == sg_policy->cached_raw_freq && !sg_policy->need_freq_update)
>>                  return sg_policy->next_freq;
>> --
>> 2.34.1
>>

      reply	other threads:[~2026-08-07 14:33 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-06  4:42 [PATCH 0/2] sched/cpufreq: Fix schedutil's boost frequency handling Sibi Sankar
2026-08-06  4:42 ` [PATCH 1/2] cpufreq: allow cpuinfo max to decrease when boost is disabled Sibi Sankar
2026-08-06  9:28   ` Dmitry Baryshkov
2026-08-06 10:11     ` Sibi Sankar
2026-08-06 12:12       ` Dmitry Baryshkov
2026-08-07 12:12         ` Sibi Sankar
2026-08-06 11:22   ` Zhongqiu Han
2026-08-07 14:23     ` Sibi Sankar
2026-08-10  9:54       ` Zhongqiu Han
2026-08-06  4:42 ` [PATCH 2/2] sched/cpufreq: Update schedutil's DVFS request to reach the boost frequencies Sibi Sankar
2026-08-06  9:02   ` Christian Loehle
2026-08-06 15:13     ` Vincent Guittot
2026-08-07 14:41       ` Sibi Sankar
2026-08-06 15:09   ` Vincent Guittot
2026-08-07 14:32     ` Sibi Sankar [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=c1f9c858-f14a-405e-97ad-0c1748b7c5a1@oss.qualcomm.com \
    --to=sibi.sankar@oss.qualcomm.com \
    --cc=bsegall@google.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=juri.lelli@redhat.com \
    --cc=kprateek.nayak@amd.com \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=mgorman@suse.de \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rafael@kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=vincent.guittot@linaro.org \
    --cc=viresh.kumar@linaro.org \
    --cc=vschneid@redhat.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®