Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1372890

Re: [PATCH 2/3] percpu_stats: Simple per-cpu statistics count helper functions

From Waiman Long <waiman.long@hpe.com>
Newsgroups linux.kernel
Subject Re: [PATCH 2/3] percpu_stats: Simple per-cpu statistics count helper functions
Date 2016-04-07 00:10 +0200
Message-ID <rl3Ob-2aQ-17@gated-at.bofh.it> (permalink)
References <rjkgq-5Ym-3@gated-at.bofh.it> <rjkgq-5Ym-9@gated-at.bofh.it> <rk7h8-8aW-7@gated-at.bofh.it> <rkgkp-6rb-1@gated-at.bofh.it> <rki2S-7T9-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 04/04/2016 03:09 PM, Christoph Lameter wrote:
> 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.
>

Yes, using this_cpu_add() will be even simpler.

Cheers,
Longman

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Re: [PATCH 2/3] percpu_stats: Simple per-cpu statistics count helper  functions Nikolay Borisov <kernel@kyup.com> - 2016-04-04 09:40 +0200
  Re: [PATCH 2/3] percpu_stats: Simple per-cpu statistics count helper  functions Waiman Long <waiman.long@hpe.com> - 2016-04-04 19:20 +0200
    Re: [PATCH 2/3] percpu_stats: Simple per-cpu statistics count helper  functions Christoph Lameter <cl@linux.com> - 2016-04-04 21:10 +0200
      Re: [PATCH 2/3] percpu_stats: Simple per-cpu statistics count helper  functions Waiman Long <waiman.long@hpe.com> - 2016-04-07 00:10 +0200

csiph-web