Re: [PATCH 1/2] x86, percpu: Optimize this_cpu_ptr

From: Tejun Heo
Date: Sun Sep 05 2010 - 05:21:25 EST


Hello,

On 09/04/2010 07:21 PM, Brian Gerst wrote:
> diff --git a/arch/x86/include/asm/percpu.h b/arch/x86/include/asm/percpu.h
> index cd28f9a..d854438 100644
> --- a/arch/x86/include/asm/percpu.h
> +++ b/arch/x86/include/asm/percpu.h
> @@ -47,6 +47,15 @@
> #ifdef CONFIG_SMP
> #define __percpu_arg(x) "%%"__stringify(__percpu_seg)":%P" #x
> #define __my_cpu_offset percpu_read(this_cpu_off)
> +#define __this_cpu_ptr(ptr) \
> +({ \
> + typeof(ptr) __ptr = (ptr); \
> + __verify_pcpu_ptr(ptr); \
> + asm volatile("add " __percpu_arg(1) ", %0" \
> + : "+r" (__ptr) \
> + : "m" (this_cpu_off)); \
> + __ptr; \
> +})

Great, thanks for doing this, but can you please comment on what
__this_cpu_ptr() optimizes above? Something similar to the patch
description but shorter.

Thanks.

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