lkml.org 
[lkml]   [2016]   [Apr]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 2/3] percpu_stats: Simple per-cpu statistics count helper functions
On Mon, 4 Apr 2016, Waiman Long wrote:

> > > + if ((unsigned int)stat>= pcs->nstats)
> > > + return;
> > > + preempt_disable();
> > > + pstat = this_cpu_ptr(&pcs->stats[stat]);
> > > + *pstat += cnt;
> > > + preempt_enable();
> > > +}
> > pstat = get_cpu_ptr(&pcs->stats[stat]);
> > *pstat += cnt;
> > put_cpu_ptr(&pcs->stats[stat]);
> >
> > It will generate identical code but this one uses APIs, making the
> > intention clearer. But as I said this is just a minor nit.
> >
> > you can add my Reviewed-by: Nikolay Borisov<kernel@kyup.com> for this
> > particular patch.
>
> Yes, that will certainly make it look nicer. I will update the patch once I
> get feedback from my other ext4 patches.

Why not

this_cpu_add(pci->stats[stat], cnt)

This is a single instruction on x86.

\
 
 \ /
  Last update: 2016-04-04 21:21    [W:0.139 / U:0.464 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site