lkml.org 
[lkml]   [2006]   [Feb]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [patch 3/4] net: Percpufy frequently used variables -- proto.sockets_allocated
Ravikiran G Thirumalai <kiran@scalex86.org> wrote:
>
> On Fri, Jan 27, 2006 at 03:01:06PM -0800, Andrew Morton wrote:
> > Ravikiran G Thirumalai <kiran@scalex86.org> wrote:
> >
> >
> > > >
> > > > If the benchmarks say that we need to. If we cannot observe any problems
> > > > in testing of existing code and if we can't demonstrate any benefit from
> > > > the patched code then one option is to go off and do something else ;)
> > >
> > > We first tried plain per-CPU counters for memory_allocated, found that reads
> > > on memory_allocated was causing cacheline transfers, and then
> > > switched over to batching. So batching reads is useful. To avoid
> > > inaccuracy, we can maybe change percpu_counter_init to:
> > >
> > > void percpu_counter_init(struct percpu_counter *fbc, int maxdev)
> > >
> > > the percpu batching limit would then be maxdev/num_possible_cpus. One would
> > > use batching counters only when both reads and writes are frequent. With
> > > the above scheme, we would go fetch cachelines from other cpus for read
> > > often only on large cpu counts, which is not any worse than the global
> > > counter alternative, but it would still be beneficial on smaller machines,
> > > without sacrificing a pre-set deviation.
> > >
> > > Comments?
> >
> > Sounds sane.
> >
>
> Here's an implementation which delegates tuning of batching to the user. We
> don't really need local_t at all as percpu_counter_mod is not safe against
> interrupts and softirqs as it is. If we have a counter which could be
> modified in process context and irq/bh context, we just have to use a
> wrapper like percpu_counter_mod_bh which will just disable and enable bottom
> halves. Reads on the counters are safe as they are atomic_reads, and the
> cpu local variables are always accessed by that cpu only.
>
> (PS: the maxerr for ext2/ext3 is just guesstimate)

Well that's the problem. We need to choose production-quality values for
use in there.

> Comments?

Using num_possible_cpus() in that header file is just asking for build
errors. Probably best to uninline the function rather than adding the
needed include of cpumask.h.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2006-02-03 04:19    [W:1.446 / U:0.048 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site