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

From: Christoph Lameter
Date: Thu Jul 10 2008 - 11:30:37 EST


H. Peter Anvin wrote:

> Noone has talked about the actual placement of the percpu segment data.

But the placement of the percpu segment data is a problem because of the way we
currently have the linker calculate offsets. I have had kernel configurations where I changed the placement of the percpu segment leading to linker failures because the percpu segment was not in 2G range of the code segment!

This is a particular problem if we have a large number of processors (like 4096) that each require a sizable segment of virtual address space up there for the per cpu allocator.

> None of this affects the absolute positioning of the data. The final
> address are determined by:
>
> fs_base + rip + offset
> or
> fs_base + offset
>
> ... respectively. fs_base is an arbitrary 64-bit number; rip (in the
> kernel) is in the range [-2 GB + CONFIG_PHYSICAL_START, 0), and offset
> is in the range [-2 GB, 2 GB).

Well the zero based results in this becoming always

gs_base + absolute address in per cpu segment

Why are RIP based references cheaper? The offset to the per cpu segment is certainly more than what can be fit into 16 bits.

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