[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <25e057c00901150559t14fd3becn5cea005895dacdc4@mail.gmail.com>
Date: Thu, 15 Jan 2009 14:59:35 +0100
From: "roel kluin" <roel.kluin@...il.com>
To: "Tejun Heo" <tj@...nel.org>
Cc: "Ingo Molnar" <mingo@...e.hu>, "H. Peter Anvin" <hpa@...or.com>,
"Brian Gerst" <brgerst@...il.com>, ebiederm@...ssion.com,
cl@...ux-foundation.org, rusty@...tcorp.com.au, travis@....com,
linux-kernel@...r.kernel.org, akpm@...ux-foundation.org,
steiner@....com, hugh@...itas.com
Subject: Re: [patch] add optimized generic percpu accessors
> +#ifndef percpu_read
> +# define percpu_read(var) \
> + ({ \
> + typeof(per_cpu_var(var)) __tmp_var__; \
> + __tmp_var__ = get_cpu_var(var); \
> + put_cpu_var(var); \
> + __tmp_var__; \
> + })
> +#endif
I'm sorry for your eyes, but since var occurs twice, isn't it better to do:
# define percpu_read(var) \
({ \
typeof(var) __pcpu_read_var__ = var;
\
typeof(per_cpu_var(__pcpu_read_var__)) __tmp_var__; \
__tmp_var__ = get_cpu_var(__pcpu_read_var__); \
put_cpu_var(__pcpu_read_var__); \
__tmp_var__; \
})
> +
> +#define __percpu_generic_to_op(var, val, op) \
> +do { \
> + get_cpu_var(var) op val; \
> + put_cpu_var(var); \
> +} while (0)
and:
#define __percpu_generic_to_op(var, val, op) \
do { \
typeof(var) __pcpu_gto_var__ = var;
\
get_cpu_var(__pcpu_gto_var__) op val;
\
put_cpu_var(__pcpu_gto_var__);
\
} while (0)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists