Re: [patch 05/14] percpu: Use a Kconfig variable to configure arch specific percpu setup

Christoph Lameter
2007-11-29T01:35:16Z

On Wed, 28 Nov 2007, Jeremy Fitzhardinge wrote:

> I don't see the problem. The way i386 does it inherently supports
> per-cpu data very early on (it uses the prototype percpu section until
> the real percpu values are set up).

Ok so we could do that for x86_64 as well? There is more complicated
bootstrap since i386 does not support NUMA aware placement of per cpu
areas.

> > The i386 way of referring to per cpu data is not optimal because it is
> > always offset by __per_cpu_start. per cpu data offsets need to be relative
> > to the beginning of the per cpu area. per cpu data is less than 64k so 2
> > byte offsets would be enough.
> >
>
> I don't see that's terribly important. percpu references aren't all
> that common overall, and - at least on x86 - using a 16-bit offset
> (assuming its possible) would require a prefix anyway, so it would only
> save 1 byte per reference. But I can't convince gas to generate a
> 16-bit offset anyway.

percpu references are quite frequent already (vm statistics) and will be
more frequent after we have converted the per cpu arrays to per cpu
allocations.

> > That way the __per_cpu_offset array and the registers that are used on
> > various platforms are pointing to the actual data and can be loaded
> > directly into a register and then a load with a small offset to that
> > register can be performed. On x86_64 this is gs, on i386 fs, on sparc g5,
> > on ia64 a fixed address stands in for the register.
>
> The asm used to generate these references is inherently arch-specific
> anyway, so the type and size of offset needed from the per-cpu base
> register to the data itself can be arch-dependent without loss of
> generality.

Well yes that is already the case and made explicit by the percpu cleanup
done so far. The offset of a base is used by multiple architectures.