Re: 2.6.9-rc3-mm2

Rusty Russell
2004-10-15T02:05:21Z

On Fri, 2004-10-15 at 11:44, Andrew Morton wrote:
> Rusty Russell <rusty@rustcorp.com.au> wrote:
> > Please, please please! Never use per_cpu(XXX, smp_processor_id())!
>
> Why?

Because that's what get_cpu_var() does, and an arch might not need to
get the processor id to do it. As more things get per-cpu-ified, and
smp_processor_id() for its own sake becomes more unusual, I expect archs
to go to smp_processor_id() as a per-cpu variable, and a register
holding the per-cpu offset. (This needs a real dynamic per-cpu
allocator, as well, which I've been meaning to polish off).

> We were getting warnings from somewhere or other due to smp_processor_id()
> within preemptible code - I don't recall the callsite.

That's weird, but implies bogosity in the caller. Covering it up like
this is not necessarily a win.

Rusty.
--
Anyone who quotes me in their signature is an idiot -- Rusty Russell