Re: [PATCH] percpu: add optimized generic percpu accessors

From: Ingo Molnar
Date: Thu Jan 15 2009 - 19:16:56 EST



* Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx> wrote:

> Ingo Molnar <mingo@xxxxxxx> 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.

Yeah. percpu_add(var, 1) does exactly that on x86.

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