Re: [patch 5/8] x86: use this_cpu_xxx to replace percpu_xxx funcs

From: Ingo Molnar
Date: Tue Mar 06 2012 - 02:46:20 EST



* akpm@xxxxxxxxxxxxxxxxxxxx <akpm@xxxxxxxxxxxxxxxxxxxx> wrote:

> From: Alex Shi <alex.shi@xxxxxxxxx>
> Subject: x86: use this_cpu_xxx to replace percpu_xxx funcs
>
> Since percpu_xxx() serial functions are duplicate with this_cpu_xxx().
> Removing percpu_xxx() definition and replacing them by this_cpu_xxx() in
> code.
>
> And further more, as Christoph Lameter's requirement, I try to use
> __this_cpu_xx to replace this_cpu_xxx if it is in preempt safe scenario.
> The preempt safe scenarios include:
> 1, in irq/softirq/nmi handler
> 2, protected by preempt_disable
> 3, protected by spin_lock
> 4, if the code context imply that it is preempt safe, like the code is
> follows or be followed a preempt safe code.
>
> BTW, In fact, this_cpu_xxx are same as __this_cpu_xxx since all funcs
> implement in a single instruction for x86 machine. But it maybe other
> platforms' performance.

but this is an x86 only patch.

> - percpu_write(irq_regs, new_regs);
> + __this_cpu_write(irq_regs, new_regs);

So what's the point of all this ugly churn?

Will percpu_write() be removed altogether? If so then the
changelog should say *that*, and explain that on x86 this is a
simple renaming of the API, not a long explanation about
scenarios that don't actually matter.

If percpu_write() is not being removed then I don't see how this
patch is an improvement: it's supposed to result in the same
instructions being emitted, and __this_cpu_write() et al are
distinctly longer to write ...

So what's the plan here?

Thanks,

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/