[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20090116215946.GA20653@elte.hu>
Date: Fri, 16 Jan 2009 22:59:46 +0100
From: Ingo Molnar <mingo@...e.hu>
To: Rusty Russell <rusty@...tcorp.com.au>
Cc: Herbert Xu <herbert@...dor.apana.org.au>,
akpm@...ux-foundation.org, tj@...nel.org, hpa@...or.com,
brgerst@...il.com, ebiederm@...ssion.com, cl@...ux-foundation.org,
travis@....com, linux-kernel@...r.kernel.org, steiner@....com,
hugh@...itas.com
Subject: Re: [PATCH] percpu: add optimized generic percpu accessors
* Rusty Russell <rusty@...tcorp.com.au> wrote:
> On Friday 16 January 2009 10:42:00 Herbert Xu wrote:
> > Ingo Molnar <mingo@...e.hu> wrote:
> > >
> > >> Of course. But do any architectures actually _need_ that for a single
> > >> read?
> > >
> > > not for a read i guess - but for the other ops like add/and/or/xor.
> >
> > One of the things I'd like to see happen with this work is for
> > us to have a cheap per-cpu atomic counter that we can use for
> > SNMP stats.
> >
> > If we can make the inc/add variants into a single instruction,
> > then it won't need to disable preemption or interrupts.
> >
> > So if you could design the API such that we have a variant of
> > add/inc that automatically disables/enables preemption then we
> > can optimise that away on x86.
>
> Yep, already on it. It's called local_t; that's what it was originally
> designed for.
>
> Unfortunately, to use it efficiently, we need large per-cpu areas.
Do you mean constructs like:
local_inc(&__get_cpu_var(var));
?
If yes then i think you are missing the point here.
Yes, local_t can be useful when something is in an object and we know only
a local IRQ context can update it and we dont want to disable irqs or use
heavy atomics.
But percpu_read()/write()/add()/sub() ops are about optimizing _percpu_
variables. local_t alone does not solve that problem - because to use
local_t as a percpu variable you have to get to the address of that
variable - and that alone is not well optimized.
Or do you propose some new API that would allow that?
Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists