On Wed, 28 Aug 2013, Russell King - ARM Linux wrote: > On Wed, Aug 28, 2013 at 07:48:23PM +0000, Christoph Lameter wrote: > > 3. Retrieve the content of the current processors instance of a per cpu variable. > > > > DEFINE_PER_CPU(int, u); > > Shouldn't this be 'y' ? Right. > > memcpy(this_cpu_ptr(&x), y, sizeof(x)); > > Are you sure this one's correct? Isn't 'y' the per-cpu variable? Also true. Already fixed this once. Sigh. Description patch: --- this_x86 2013-08-28 15:35:48.933416126 -0500 +++ patches/this_x86 2013-08-28 15:41:14.386260894 -0500 @@ -26,12 +26,12 @@ This patch converts __get_cpu_var into either an explicit address calculation using this_cpu_ptr() -or into a use of this_cpu operations that use the offset. Thereby address calcualtions are avoided +or into a use of this_cpu operations that use the offset. Thereby address calculations are avoided and less registers are used when code is generated. -At the end of the patchset all uses of __get_cpu_var have been removed so the macro is removed too. +At the end of the patch set all uses of __get_cpu_var have been removed so the macro is removed too. -The patchset includes passes over all arches as well. Once these operations are used throughout then +The patch set includes passes over all arches as well. Once these operations are used throughout then specialized macros can be defined in non -x86 arches as well in order to optimize per cpu access by f.e. using a global register that may be set to the per cpu base. @@ -63,7 +63,7 @@ 3. Retrieve the content of the current processors instance of a per cpu variable. - DEFINE_PER_CPU(int, u); + DEFINE_PER_CPU(int, y); int x = __get_cpu_var(y) Converts to @@ -78,7 +78,7 @@ Converts to - memcpy(this_cpu_ptr(&x), y, sizeof(x)); + memcpy(&x, this_cpu_ptr(&y), sizeof(x)); 5. Assignment to a per cpu variable -- To unsubscribe from this list: send the line "unsubscribe linux-arch" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html