[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <6f794935-a5d2-0f4d-70d7-de4705ba9511@arm.com>
Date: Fri, 25 Sep 2020 09:21:13 +0100
From: Lukasz Luba <lukasz.luba@....com>
To: Viresh Kumar <viresh.kumar@...aro.org>,
Rafael Wysocki <rjw@...ysocki.net>
Cc: linux-pm@...r.kernel.org,
Vincent Guittot <vincent.guittot@...aro.org>,
cristian.marussi@....com, sudeep.holla@....com,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH V2 1/4] cpufreq: stats: Defer stats update to
cpufreq_stats_record_transition()
On 9/16/20 7:45 AM, Viresh Kumar wrote:
> In order to prepare for lock-less stats update, add support to defer any
> updates to it until cpufreq_stats_record_transition() is called.
>
> Signed-off-by: Viresh Kumar <viresh.kumar@...aro.org>
> ---
> drivers/cpufreq/cpufreq_stats.c | 75 ++++++++++++++++++++++++---------
> 1 file changed, 56 insertions(+), 19 deletions(-)
>
[snip]
> @@ -228,10 +264,11 @@ void cpufreq_stats_record_transition(struct cpufreq_policy *policy,
> struct cpufreq_stats *stats = policy->stats;
> int old_index, new_index;
>
> - if (!stats) {
> - pr_debug("%s: No stats found\n", __func__);
> + if (!stats)
> return;
> - }
> +
> + if (READ_ONCE(stats->reset_pending))
> + cpufreq_stats_reset_table(stats);
>
This is in the hot path code, called from the scheduler. I wonder if we
avoid it or make that branch 'unlikely'?
if (unlikely(READ_ONCE(stats->reset_pending)))
Probably the CPU (when it has good prefetcher) would realize about it,
but maybe we can help a bit here.
Powered by blists - more mailing lists