lkml.org 
[lkml]   [2020]   [Sep]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH V2 1/4] cpufreq: stats: Defer stats update to cpufreq_stats_record_transition()
On 25-09-20, 09:21, Lukasz Luba wrote:
>
>
> 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@linaro.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.

Sure.

--
viresh

\
 
 \ /
  Last update: 2020-09-25 12:47    [W:0.205 / U:1.152 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site