From: Qais Yousef <qyousef@layalina.io>
To: Pierre Gondois <pierre.gondois@arm.com>
Cc: "Rafael J. Wysocki" <rafael@kernel.org>,
Viresh Kumar <viresh.kumar@linaro.org>,
linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org,
Ingo Molnar <mingo@kernel.org>,
Peter Zijlstra <peterz@infradead.org>,
Vincent Guittot <vincent.guittot@linaro.org>,
Dietmar Eggemann <dietmar.eggemann@arm.com>,
Christian.Loehle@arm.com
Subject: Re: [PATCH] cpufreq: Change default transition delay to 2ms
Date: Fri, 23 Feb 2024 13:27:36 +0000 [thread overview]
Message-ID: <20240223132736.xp3c3k4k6y2a2ep7@airbuntu> (raw)
In-Reply-To: <fdd82ddb-82bc-4c8c-86ef-c80505881013@arm.com>
On 02/23/24 10:48, Pierre Gondois wrote:
> > diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
> > index 66cef33c4ec7..668263c53810 100644
> > --- a/drivers/cpufreq/cpufreq.c
> > +++ b/drivers/cpufreq/cpufreq.c
> > @@ -576,8 +576,17 @@ unsigned int cpufreq_policy_transition_delay_us(struct cpufreq_policy *policy)
> > latency = policy->cpuinfo.transition_latency / NSEC_PER_USEC;
> > if (latency) {
> > + unsigned int max_delay_us = 2 * MSEC_PER_SEC;;
> > +
> > + /*
> > + * If the platform already has high transition_latency, use it
> > + * as-is.
> > + */
> > + if (latency > max_delay_us)
> > + return latency;
> > +
> > /*
> > - * For platforms that can change the frequency very fast (< 10
> > + * For platforms that can change the frequency very fast (< 20
>
> I think it should be 10->2us as we do:
> min(latency * 1000, 2ms)
Yeah I meant 2, that was a typo
Thanks
-->8--
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index 66cef33c4ec7..de92a9912587 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -576,8 +576,17 @@ unsigned int cpufreq_policy_transition_delay_us(struct cpufreq_policy *policy)
latency = policy->cpuinfo.transition_latency / NSEC_PER_USEC;
if (latency) {
+ unsigned int max_delay_us = 2 * MSEC_PER_SEC;;
+
+ /*
+ * If the platform already has high transition_latency, use it
+ * as-is.
+ */
+ if (latency > max_delay_us)
+ return latency;
+
/*
- * For platforms that can change the frequency very fast (< 10
+ * For platforms that can change the frequency very fast (< 2
* us), the above formula gives a decent transition delay. But
* for platforms where transition_latency is in milliseconds, it
* ends up giving unrealistic values.
@@ -586,7 +595,7 @@ unsigned int cpufreq_policy_transition_delay_us(struct cpufreq_policy *policy)
* a reasonable amount of time after which we should reevaluate
* the frequency.
*/
- return min(latency * LATENCY_MULTIPLIER, (unsigned int)(2 * MSEC_PER_SEC));
+ return min(latency * LATENCY_MULTIPLIER, max_delay_us);
}
return LATENCY_MULTIPLIER;
next prev parent reply other threads:[~2024-02-23 13:27 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-05 2:25 [PATCH] cpufreq: Change default transition delay to 2ms Qais Yousef
2024-02-05 7:45 ` Viresh Kumar
2024-02-12 15:53 ` Rafael J. Wysocki
2024-02-14 9:19 ` Pierre Gondois
2024-02-20 13:50 ` Qais Yousef
2024-02-20 17:38 ` Pierre Gondois
2024-02-22 11:55 ` Qais Yousef
2024-02-22 15:15 ` Pierre Gondois
2024-02-22 23:39 ` Qais Yousef
2024-02-23 9:48 ` Pierre Gondois
2024-02-23 13:27 ` Qais Yousef [this message]
2024-02-27 23:34 ` [PATCH] cpufreq: Honour transition_latency over transition_delay_us Qais Yousef
2024-02-29 19:26 ` Rafael J. Wysocki
2024-02-20 13:49 ` [PATCH] cpufreq: Change default transition delay to 2ms Qais Yousef
2024-02-05 9:17 ` Christian Loehle
2024-02-05 12:01 ` Qais Yousef
2024-02-05 17:35 ` Christian Loehle
2024-02-05 21:54 ` Qais Yousef
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=20240223132736.xp3c3k4k6y2a2ep7@airbuntu \
--to=qyousef@layalina.io \
--cc=Christian.Loehle@arm.com \
--cc=dietmar.eggemann@arm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=peterz@infradead.org \
--cc=pierre.gondois@arm.com \
--cc=rafael@kernel.org \
--cc=vincent.guittot@linaro.org \
--cc=viresh.kumar@linaro.org \
/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