Re: What is the difference between percpu_xxx and this_cpu_xxx?

From: Tejun Heo
Date: Tue Sep 13 2011 - 03:40:17 EST


On Tue, Sep 13, 2011 at 02:14:06PM +0800, Huang Ying wrote:
> Hi, Eric,
>
> On 09/13/2011 02:11 PM, Eric Dumazet wrote:
> > Le mardi 13 septembre 2011 Ã 12:28 +0800, Huang Ying a Ãcrit :
> >> Hi,
> >>
> >> If my understanding was correct, from the kernel source code, it appears
> >> that percpu_xxx and this_cpu_xxx have the same semantics and
> >> implementation in effect, havenât them?
> >>
> >> If so, why do we need two API for the same thing?
> >
> > History mostly, and transition.
> >
> > percpu_inc() was an x86 only thing
> >
> > __get_cpu_var(var)++ -> percpu_inc(var) -> this_cpu_inc(var)

Also, we used to need separate accessors for static and dynamic percpu
variables, so we have quite a few duplications in the interface.

> Thanks for clarification. Is there someone working on the transition?
> Is that possible to translate most percpu_xxx to this_cpu_xxx blindly?

It's on my todo list but AFAIK nobody is actually working on it yet.

Thanks.

--
tejun
--
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/