Greg Banks wrote: > On Wed, May 23, 2007 at 09:36:55AM -0400, Chuck Lever wrote: >> Greg Banks wrote: >>> On Wed, May 23, 2007 at 12:22:44AM -0500, Tom Tucker wrote: >>>> >>>> On 5/22/07 9:32 PM, "Greg Banks" wrote: >>>> >>>>> On Tue, May 22, 2007 at 12:34:23PM -0500, Tom Tucker wrote: >>>> I need to do a little clean up (e.g. atomic_inc()) and then I'll add them >>>> as >>>> suggested. If there are dissenters, please speak now... >>> You should be able to get away with just ++. They're only stats, >>> it's not like you have logic depending on them being exact. >> The usual way to do this is to allocate separate stat arrays for each >> CPU. All the per-CPU arrays are summed only when something wants to >> display stat totals. >> >> That way you can use ++, be fairly sure you will get accurate >> statistics, and not have to be concerned about CPU cache effects or lock >> contention. > > Here in SGI, home of the multiple-thousand CPU Linux boxes, making > data structures per-cpu tends to be done...thoughtfully. > > In any case, the remainder of svc_stat gets no such treatment today. I based the new NFS client stats on what was done by the networking layer, which uses the per-CPU pattern. I was under the impression that methodology was preferred for adding new stat keeping. But I'm aware that the existing NFS client and server stat keeping infrastructure uses just a simple array for each RPC program/version.