From: Waiman Long Subject: Re: [PATCH 2/3] percpu_stats: Simple per-cpu statistics count helper functions Date: Wed, 6 Apr 2016 17:53:08 -0400 Message-ID: <57058544.1000204@hpe.com> References: <1459566578-30221-1-git-send-email-Waiman.Long@hpe.com> <1459566578-30221-3-git-send-email-Waiman.Long@hpe.com> <57021969.8050504@kyup.com> <5702A053.5030404@hpe.com> Mime-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1"; format=flowed Content-Transfer-Encoding: 7bit Cc: Nikolay Borisov , Theodore Ts'o , Andreas Dilger , Tejun Heo , , , Scott J Norton , Douglas Hatch , Toshimitsu Kani To: Christoph Lameter Return-path: In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org List-Id: linux-ext4.vger.kernel.org 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 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