linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Waiman Long <waiman.long@hpe.com>
To: Nikolay Borisov <kernel@kyup.com>
Cc: Theodore Ts'o <tytso@mit.edu>,
	Andreas Dilger <adilger.kernel@dilger.ca>,
	Tejun Heo <tj@kernel.org>, Christoph Lameter <cl@linux.com>,
	<linux-ext4@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	Scott J Norton <scott.norton@hpe.com>,
	Douglas Hatch <doug.hatch@hpe.com>,
	Toshimitsu Kani <toshi.kani@hpe.com>
Subject: Re: [PATCH 2/3] percpu_stats: Simple per-cpu statistics count helper functions
Date: Mon, 4 Apr 2016 13:11:47 -0400	[thread overview]
Message-ID: <5702A053.5030404@hpe.com> (raw)
In-Reply-To: <57021969.8050504@kyup.com>

On 04/04/2016 03:36 AM, Nikolay Borisov wrote:
>
> On 04/02/2016 06:09 AM, Waiman Long wrote:
>> This patch introduces a set of simple per-cpu statictics count helper
>> functions that can be used by other kernel subsystems for keeping
>> track of the number of events that happens. It is per-cpu based to
>> reduce overhead and improve accuracy of the counter. Using per-cpu
>> counter is usually overkill for such purpose.
>>
>> The following APIs are provided:
>>
>>   - int percpu_stats_init(struct percpu_stats *pcs, int num)
>>     Initialize the per-cpu statictics counts structure which should have
>>     the given number of statistics counts. Return -ENOMEM on error.
>>
>>   - void percpu_stats_destroy(struct percpu_stats *pcs)
>>     Free the percpu memory allocated.
>>
>>   - void percpu_stats_inc(struct percpu_stats *pcs, int stat)
>>     void percpu_stats_dec(struct percpu_stats *pcs, int stat)
>>     Increment and decrement the given per-cpu statistics count.
>>
>>   - unsigned long percpu_stats_sum(struct percpu_stats *pcs, int stat)
>>     Return the current aggregated sum of the given statistics count.
>>
>>   - void percpu_stats_reset(struct percpu_stats *pcs)
>>     Clear all the statistics counts defined in the given percpu_stats
>>     structure.
>>
>> Signed-off-by: Waiman Long<Waiman.Long@hpe.com>
>> ---
>>   include/linux/percpu_stats.h |  103 ++++++++++++++++++++++++++++++++++++++++++
>>   1 files changed, 103 insertions(+), 0 deletions(-)
>>   create mode 100644 include/linux/percpu_stats.h
> Just one minor nit below.
> [..]
>> +static inline void
>> +__percpu_stats_add(struct percpu_stats *pcs, int stat, int cnt)
>> +{
>> +	unsigned long *pstat;
>> +
>> +	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.

Cheers,
Longman

  reply	other threads:[~2016-04-04 17:11 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-02  3:09 [PATCH 0/3] ext4: Improve parallel I/O performance on NVDIMM Waiman Long
2016-04-02  3:09 ` [PATCH 1/3] ext4: Pass in DIO_SKIP_DIO_COUNT flag if inode_dio_begin() called Waiman Long
2016-04-02  3:09 ` [PATCH 2/3] percpu_stats: Simple per-cpu statistics count helper functions Waiman Long
2016-04-04  7:36   ` Nikolay Borisov
2016-04-04 17:11     ` Waiman Long [this message]
2016-04-04 19:09       ` Christoph Lameter
2016-04-06 21:53         ` Waiman Long
2016-04-04 16:02   ` Tejun Heo
2016-04-06 19:52     ` Waiman Long
2016-04-06 21:51     ` Waiman Long
2016-04-06 22:54       ` Tejun Heo
2016-04-07 15:58         ` Waiman Long
2016-04-07 16:06           ` Tejun Heo
2016-04-07 18:52             ` Waiman Long
2016-04-07 18:58               ` Tejun Heo
2016-04-07 20:37                 ` Waiman Long
2016-04-07 20:41                   ` Tejun Heo
2016-04-07 21:38                     ` Waiman Long
2016-04-02  3:09 ` [PATCH 3/3] ext4: Make cache hits/misses per-cpu counts Waiman Long

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5702A053.5030404@hpe.com \
    --to=waiman.long@hpe.com \
    --cc=adilger.kernel@dilger.ca \
    --cc=cl@linux.com \
    --cc=doug.hatch@hpe.com \
    --cc=kernel@kyup.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=scott.norton@hpe.com \
    --cc=tj@kernel.org \
    --cc=toshi.kani@hpe.com \
    --cc=tytso@mit.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).