From: "Rafael J. Wysocki" <rafael@kernel.org>
To: Viresh Kumar <viresh.kumar@linaro.org>
Cc: Rafael Wysocki <rjw@rjwysocki.net>,
Linux PM <linux-pm@vger.kernel.org>,
Vincent Guittot <vincent.guittot@linaro.org>,
Lukasz Luba <lukasz.luba@arm.com>,
cristian.marussi@arm.com, Sudeep Holla <sudeep.holla@arm.com>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH V2 3/4] cpufreq: stats: Enable stats for fast-switch as well
Date: Wed, 23 Sep 2020 17:14:49 +0200 [thread overview]
Message-ID: <CAJZ5v0hpT9CAb1hxKcQVA-OJP3UYja=Kqvgh-Ed4N8Ln+=2b5A@mail.gmail.com> (raw)
In-Reply-To: <c9dc39f9956ad9851511d6710e8f8a5cb142789e.1600238586.git.viresh.kumar@linaro.org>
On Wed, Sep 16, 2020 at 8:46 AM Viresh Kumar <viresh.kumar@linaro.org> wrote:
>
> Now that all the blockers are gone for enabling stats in fast-switching
> case, enable it.
>
> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
> ---
> drivers/cpufreq/cpufreq.c | 6 +++++-
> drivers/cpufreq/cpufreq_stats.c | 6 ------
> 2 files changed, 5 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
> index 47aa90f9a7c2..d5fe64e96be9 100644
> --- a/drivers/cpufreq/cpufreq.c
> +++ b/drivers/cpufreq/cpufreq.c
> @@ -2057,8 +2057,12 @@ unsigned int cpufreq_driver_fast_switch(struct cpufreq_policy *policy,
> unsigned int target_freq)
> {
> target_freq = clamp_val(target_freq, policy->min, policy->max);
> + target_freq = cpufreq_driver->fast_switch(policy, target_freq);
>
> - return cpufreq_driver->fast_switch(policy, target_freq);
> + if (target_freq)
> + cpufreq_stats_record_transition(policy, target_freq);
So this adds two extra branches in the scheduler path for the cases
when the stats are not used at all which seems avoidable to some
extent.
Can we check policy->stats upfront here and bail out right away if it
is not set, for example?
> +
> + return target_freq;
> }
> EXPORT_SYMBOL_GPL(cpufreq_driver_fast_switch);
>
> diff --git a/drivers/cpufreq/cpufreq_stats.c b/drivers/cpufreq/cpufreq_stats.c
> index 314fa1d506d0..daea17f0c36c 100644
> --- a/drivers/cpufreq/cpufreq_stats.c
> +++ b/drivers/cpufreq/cpufreq_stats.c
> @@ -69,9 +69,6 @@ static ssize_t show_time_in_state(struct cpufreq_policy *policy, char *buf)
> ssize_t len = 0;
> int i;
>
> - if (policy->fast_switch_enabled)
> - return 0;
> -
> for (i = 0; i < stats->state_num; i++) {
> if (pending) {
> if (i == stats->last_index)
> @@ -115,9 +112,6 @@ static ssize_t show_trans_table(struct cpufreq_policy *policy, char *buf)
> ssize_t len = 0;
> int i, j, count;
>
> - if (policy->fast_switch_enabled)
> - return 0;
> -
> len += scnprintf(buf + len, PAGE_SIZE - len, " From : To\n");
> len += scnprintf(buf + len, PAGE_SIZE - len, " : ");
> for (i = 0; i < stats->state_num; i++) {
> --
> 2.25.0.rc1.19.g042ed3e048af
>
next prev parent reply other threads:[~2020-09-23 15:15 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-16 6:45 [PATCH V2 0/4] cpufreq: Record stats with fast-switching Viresh Kumar
2020-09-16 6:45 ` [PATCH V2 1/4] cpufreq: stats: Defer stats update to cpufreq_stats_record_transition() Viresh Kumar
2020-09-23 13:48 ` Rafael J. Wysocki
2020-09-24 9:25 ` Lukasz Luba
2020-09-24 10:24 ` Rafael J. Wysocki
2020-09-24 11:00 ` Lukasz Luba
2020-09-24 11:07 ` Rafael J. Wysocki
2020-09-24 12:39 ` Viresh Kumar
2020-09-24 16:10 ` Lukasz Luba
2020-09-25 6:09 ` Viresh Kumar
2020-09-25 8:10 ` Lukasz Luba
2020-09-24 13:15 ` Viresh Kumar
2020-09-25 10:04 ` Rafael J. Wysocki
2020-09-25 10:58 ` Viresh Kumar
2020-09-25 11:09 ` Rafael J. Wysocki
2020-09-25 11:26 ` Viresh Kumar
2020-09-25 8:21 ` Lukasz Luba
2020-09-25 10:46 ` Viresh Kumar
2020-09-16 6:45 ` [PATCH V2 2/4] cpufreq: stats: Remove locking Viresh Kumar
2020-09-16 6:45 ` [PATCH V2 3/4] cpufreq: stats: Enable stats for fast-switch as well Viresh Kumar
2020-09-23 15:14 ` Rafael J. Wysocki [this message]
2020-09-23 15:17 ` Rafael J. Wysocki
2020-09-16 6:45 ` [PATCH V2 4/4] cpufreq: Move traces and update to policy->cur to cpufreq core Viresh Kumar
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='CAJZ5v0hpT9CAb1hxKcQVA-OJP3UYja=Kqvgh-Ed4N8Ln+=2b5A@mail.gmail.com' \
--to=rafael@kernel.org \
--cc=cristian.marussi@arm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=lukasz.luba@arm.com \
--cc=rjw@rjwysocki.net \
--cc=sudeep.holla@arm.com \
--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;
as well as URLs for NNTP newsgroup(s).