Re: [PATCH] cpufreq: stats: Use lock by stat to replace global spin lock

From: Viresh Kumar
Date: Mon Apr 08 2019 - 01:39:53 EST


On 26-03-19, 11:43, Matthias Kaehlcke wrote:
> On Mon, Mar 25, 2019 at 03:29:33PM +0800, Kyle Lin wrote:
> > Stats is updated by each policy, using the lock by stat can
> > reduce the contention.
> >
> > Signed-off-by: Kyle Lin <linkyle0915@xxxxxxxxx>
> > ---
> > drivers/cpufreq/cpufreq_stats.c | 15 ++++++++-------
> > 1 file changed, 8 insertions(+), 7 deletions(-)
> >
> > diff --git a/drivers/cpufreq/cpufreq_stats.c b/drivers/cpufreq/cpufreq_stats.c
> > index e2db5581489a..17beb1bc7e16 100644
> > --- a/drivers/cpufreq/cpufreq_stats.c
> > +++ b/drivers/cpufreq/cpufreq_stats.c
> > @@ -14,7 +14,6 @@
> > #include <linux/module.h>
> > #include <linux/slab.h>
> >
> > -static DEFINE_SPINLOCK(cpufreq_stats_lock);
> >
> > struct cpufreq_stats {
> > unsigned int total_trans;
> > @@ -23,6 +22,7 @@ struct cpufreq_stats {
> > unsigned int state_num;
> > unsigned int last_index;
> > u64 *time_in_state;
> > + spinlock_t lock; /*spinlock for stats update*/
>
> nit: not sure if the comment adds much value. If it stay there it
> needs a blank after '/*' and another before '*/'

Just drop the comment please.

--
viresh