lkml.org 
[lkml]   [2010]   [Oct]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] percpu_counter : add percpu_counter_add_fast()
On Thu, 21 Oct 2010 18:10:13 -0500 (CDT) Christoph Lameter <cl@linux.com> wrote:

> On Thu, 21 Oct 2010, Andrew Morton wrote:
>
> > That isn't actually what I was suggesting. I was suggesting the use of
> > an inlined, this_cpu_add()-using percpu_counter_add() variant which
> > still does the batched spilling into ->count. IOW, just speed up the
> > current implementation along the lines of
> >
> > {
> > val = this_cpu_add_return(*fbc->counters, amount);
>
> this_cpu_add_return() is not in the kernel but could be realized using a
> variant offshoot of cmpxchg_local. I had something like that initially but
> omitted it since there was no use case.

this_cpu_add_return() isn't really needed in this application.

{
this_cpu_add(*fbc->counters, amount);
if (unlikely(abs(this_cpu_read(*fbc->counters)) > fbc->batch))
out_of_line_stuff();
}
will work just fine.


\
 
 \ /
  Last update: 2010-10-22 02:49    [from the cache]
©2003-2011 Jasper Spaans