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

From: Jeremy Fitzhardinge
Date: Wed Jul 09 2008 - 16:47:21 EST


Arjan van de Ven wrote:
what's wrong with zero based btw?

Nothing in princple. In practice it's triggering an amazing variety of toolchain bugs.

do they stop us from using gcc's __thread keyword for per cpu variables
or something? (*that* would be a nice feature)

The powerpc guys tried it, and it doesn't work. per-cpu is not semantically equivalent to per-thread. If you have a function in which you refer to a percpu variable and then have a preemptable section in the middle followed by another reference to the same percpu variable, it's hard to stop gcc from caching a reference to the old tls variable, even though we may have switched cpus in the meantime.

Also, we explicitly use the other segment register in kernel mode, to avoid segment register switches where possible. Even with -mcmodel=kernel, gcc generates %fs references to tls variables.

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