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

2016-04-07 Thread Waiman Long
On 04/07/2016 04:41 PM, Tejun Heo wrote: Hello, Waiman. On Thu, Apr 07, 2016 at 04:37:06PM -0400, Waiman Long wrote: I would say that because I am lazy, I don't want compute the deltas every time I want to see the effect of running a certain type of workload on the statistics counts. I have use

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

2016-04-07 Thread Tejun Heo
Hello, Waiman. On Thu, Apr 07, 2016 at 04:37:06PM -0400, Waiman Long wrote: > I would say that because I am lazy, I don't want compute the deltas every > time I want to see the effect of running a certain type of workload on the > statistics counts. I have use case that I need to track 10 or so st

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

2016-04-07 Thread Waiman Long
On 04/07/2016 02:58 PM, Tejun Heo wrote: Hello, Waiman. On Thu, Apr 07, 2016 at 02:52:33PM -0400, Waiman Long wrote: As long as atomic reset is an optional feature that caller can choose at init time, I am OK to provide this functionality. I just don't want it to be the default because of the p

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

2016-04-07 Thread Waiman Long
On 04/07/2016 12:06 PM, Tejun Heo wrote: Hello, Waiman. On Thu, Apr 07, 2016 at 11:58:13AM -0400, Waiman Long wrote: We can certainly make it watertight. However, that will certainly require adding performance overhead in the percpu stats update fast path which I am not willing to pay. There a

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

2016-04-07 Thread Tejun Heo
Hello, Waiman. On Thu, Apr 07, 2016 at 02:52:33PM -0400, Waiman Long wrote: > As long as atomic reset is an optional feature that caller can choose at > init time, I am OK to provide this functionality. I just don't want it to be > the default because of the performance overhead. Please take a lo

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

2016-04-07 Thread Tejun Heo
Hello, Waiman. On Thu, Apr 07, 2016 at 11:58:13AM -0400, Waiman Long wrote: > We can certainly make it watertight. However, that will certainly require > adding performance overhead in the percpu stats update fast path which I am > not willing to pay. There are multiple options depending on the s

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

2016-04-07 Thread Waiman Long
On 04/06/2016 06:54 PM, Tejun Heo wrote: Hello, On Wed, Apr 06, 2016 at 05:51:45PM -0400, Waiman Long wrote: + /* +* If a statistics count is in the middle of being updated, it +* is possible that the above clearing may not work. So we need +* to double check again

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

2016-04-06 Thread Tejun Heo
Hello, On Wed, Apr 06, 2016 at 05:51:45PM -0400, Waiman Long wrote: > >>+ /* > >>+* If a statistics count is in the middle of being updated, it > >>+* is possible that the above clearing may not work. So we need > >>+* to double check again to make sure that the counters are really >

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

2016-04-06 Thread Waiman Long
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 =

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

2016-04-06 Thread Waiman Long
On 04/04/2016 12:02 PM, Tejun Heo wrote: Hello, On Fri, Apr 01, 2016 at 11:09:37PM -0400, Waiman Long wrote: ... +struct percpu_stats { + unsigned long __percpu *stats; I'm not sure ulong is the best choice here. Atomic reads on 32bit are nice but people often need 64bit counters for st

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

2016-04-06 Thread Waiman Long
On 04/04/2016 12:02 PM, Tejun Heo wrote: Hello, On Fri, Apr 01, 2016 at 11:09:37PM -0400, Waiman Long wrote: ... +struct percpu_stats { + unsigned long __percpu *stats; I'm not sure ulong is the best choice here. Atomic reads on 32bit are nice but people often need 64bit counters for st

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

2016-04-04 Thread Christoph Lameter
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

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

2016-04-04 Thread Waiman Long
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 re

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

2016-04-04 Thread Tejun Heo
Hello, On Fri, Apr 01, 2016 at 11:09:37PM -0400, Waiman Long wrote: ... > +struct percpu_stats { > + unsigned long __percpu *stats; I'm not sure ulong is the best choice here. Atomic reads on 32bit are nice but people often need 64bit counters for stats. It probably is a better idea to use

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

2016-04-04 Thread Nikolay Borisov
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

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

2016-04-01 Thread Waiman Long
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 f