Re: 2.6.9-rc3-mm2

From: Rusty Russell
Date: Thu Oct 14 2004 - 21:06:42 EST


On Fri, 2004-10-15 at 11:44, Andrew Morton wrote:
> Rusty Russell <rusty@xxxxxxxxxxxxxxx> 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

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