Re: [thiscpuops upgrade 03/10] percpu: Generic support for this_cpu_add,sub,dec,inc_return

From: Tejun Heo
Date: Fri Nov 26 2010 - 11:32:12 EST


On 11/24/2010 12:51 AM, Christoph Lameter wrote:
> Introduce generic support for this_cpu_add_return etc.
>
> The fallback is to realize these operations with __this_cpu_ops.
>
> Signed-off-by: Christoph Lameter <cl@xxxxxxxxx>
>
> ---
> include/linux/percpu.h | 70 +++++++++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 70 insertions(+)
>
> Index: linux-2.6/include/linux/percpu.h
> ===================================================================
> --- linux-2.6.orig/include/linux/percpu.h 2010-11-23 17:29:46.000000000 -0600
> +++ linux-2.6/include/linux/percpu.h 2010-11-23 17:31:14.000000000 -0600
> @@ -240,6 +240,20 @@ extern void __bad_size_call_parameter(vo
> pscr_ret__; \
> })
>
> +#define __pcpu_size_call_return2(stem, variable, ...) \
> +({ typeof(variable) pscr_ret__; \
> + __verify_pcpu_ptr(&(variable)); \
> + switch(sizeof(variable)) { \
> + case 1: pscr_ret__ = stem##1(variable, __VA_ARGS__);break; \
> + case 2: pscr_ret__ = stem##2(variable, __VA_ARGS__);break; \
> + case 4: pscr_ret__ = stem##4(variable, __VA_ARGS__);break; \
> + case 8: pscr_ret__ = stem##8(variable, __VA_ARGS__);break; \
> + default: \
> + __bad_size_call_parameter();break; \
> + } \
> + pscr_ret__; \
> +})

If we're gonna do __VA_ARGS__, can't we just replace
__pcpu_size_call_return()? Other than that, looks good to me.

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/