Re: [RFC 00/15] x86_64: Optimize percpu accesses

From: H. Peter Anvin
Date: Wed Jul 09 2008 - 16:43:33 EST


Christoph Lameter wrote:

Another reason to use a zero based per cpu area is to limit the offset range. Limiting the offset range allows in turn to limit the size of the generated instructions because it is part of the instruction. It also is easier to handle since __per_cpu_start does not figure
in the calculation of the offsets.


No, that makes no difference. There is no short-offset form that doesn't involve a register (ignoring the 16-bit 67h form on 32 bits.)

For 64 bits, you want to keep the offsets within %rip±2 GB, or you will have relocation overflows for %rip-based forms; for absolute forms you have to be in the range 0-4 GB. The %rip-based forms are shorter, and I'm pretty sure they're the ones we currently generate. Since we base the kernel at 0xffffffff80000000 (-2 GB) this means a zero-based offset is actively wrong, and only work by accident (since the first CONFIG_PHYSICAL_START of that space is unused.)

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