Messages in this thread Patch in this message | | | Subject | Re: [PATCH 1/2] Make the batch size of the percpu_counter configurable | From | Tim Chen <> | Date | Tue, 30 Apr 2013 10:48:14 -0700 |
| |
On Tue, 2013-04-30 at 17:28 +0000, Christoph Lameter wrote: > On Tue, 30 Apr 2013, Tim Chen wrote: > > > On Tue, 2013-04-30 at 13:32 +0000, Christoph Lameter wrote: > > > On Mon, 29 Apr 2013, Tim Chen wrote: > > > > > > > diff --git a/include/linux/percpu_counter.h b/include/linux/percpu_counter.h > > > > index d5dd465..5ca7df5 100644 > > > > --- a/include/linux/percpu_counter.h > > > > +++ b/include/linux/percpu_counter.h > > > > @@ -22,6 +22,7 @@ struct percpu_counter { > > > > struct list_head list; /* All percpu_counters are on a list */ > > > > #endif > > > > s32 __percpu *counters; > > > > + int *batch ____cacheline_aligned_in_smp; > > > > }; > > > > > > What is this for and why does it have that alignmend? > > > > I was assuming that if batch is frequently referenced, it probably > > should not share a cache line with the counters field. > > And why is it a pointer?
A pointer because the default percpu_counter_batch value could change later when cpus come online after we initialize per cpu counter and percpu_counter_batch will get computed again in percpu_counter_startup. Making it a pointer will make it unnecessary to come back and change the batch sizes if we use static batch value and default batch size.
> > And the pointer is so frequently changed that it needs it own cache line? >
On second thought, your're right. It is unnecessary for *batch to have its own cache line as the counters pointer and head_list above it will not change frequently. I'll remove the cache alignment.
Tim
| |