Re: [PATCH/RFC 1/6] numa: Use Generic Per-cpu Variables for numa_node_id()

Lee Schermerhorn
2009-12-02T16:29:25Z

On Tue, 2009-12-01 at 00:43 +0100, Arnd Bergmann wrote:
> On Monday 30 November 2009, Lee Schermerhorn wrote:
> > Looking at other asm/foo.h and asm-generic/foo.h relationships, I see
> > that some define the generic version of the api in the asm-generic
> > header if the arch asm header hasn't already defined it. asm/topology.h
> > is an instance of this. It includes asm-generic/topology.h after
> > defining arch specific versions of some of the api.
>
> This works alright, but if you expect every architecture to include the
> asm-generic version, you might just as well take that choice away from
> the architecture and put the common code into the linux/foo.h file,
> which you can still override with definitions in asm/foo.h.
>
> Most of the asm-generic headers are just mostly generic, and get included
> by some but not all architectures, the others defining the whole contents
> of the asm-generic file themselves in a different way.
>
> So if you e.g. want ia64 to do everything itself and all other architectures to
> share some or all parts of asm-generic/topology, your approach is right,
> otherwise just leave the code in some file in include/linux/.

Actually, I just wanted to make the generic definitions of
this_cpu_{read|write}() visible to topology.h when building on ia64 w/o
the circular header dependencies. Willy pointed out a way to do this by
un-inlining __alloc_percpu(). Perhaps this is the way to go. Tejun is
looking at the patches.

Lee