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

Christoph Lameter
2007-11-29T02:06:19Z

On Wed, 28 Nov 2007, Jeremy Fitzhardinge wrote:

> > 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.
> >
>
> Well, I think the point is moot, because x86 will always use 32-bit
> offsets. Each reference will only be 1 byte bigger than a normal
> variable reference.

Just because i386 is not able to use it does not mean that other arches
are not. F.e. IA64 can embedd offsets in the actual instruction (but of
course not 64bit).

x86_64 can use a 32 bit offset instead of a 64 bit addres because it uses
the small model. A load of a 64 bit address would require much more
expensive instructions. A load of a 64 bit address is currently avoided
through the use of the pda that contains the full 64 bit address in the
data_offset field. Operations on per cpu data on x86_64 must therefore
first load data_offset via gs and then add the per cpu address to this
offset. Then the per cpu operation is performed on that address.

In order to avoid this situation through one instruction we need a small
32 bit offset relative to gs. Otherwise we cannot get away from the PDA
and the use of data_offset.