* [PATCH 1/2] percpu: add percpu_variable_ptr()
@ 2010-06-23 10:04 Lai Jiangshan
2010-06-23 10:07 ` Tejun Heo
0 siblings, 1 reply; 4+ messages in thread
From: Lai Jiangshan @ 2010-06-23 10:04 UTC (permalink / raw)
To: Tejun Heo, Paul E. McKenney, Ingo Molnar, LKML
The percpu variable and allocated percpu data are compatible
witch each other, This patch adds a API, thus we can use
per_cpu_ptr() for defined/declared percpu variable.
Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
---
diff --git a/include/linux/percpu-defs.h b/include/linux/percpu-defs.h
index ce2dc65..d5c8d7f 100644
--- a/include/linux/percpu-defs.h
+++ b/include/linux/percpu-defs.h
@@ -81,6 +81,12 @@
#endif
/*
+ * Ptr of the declared/defined per-CPU variable.
+ * It is totally compatible with the return from alloc_percpu().
+ */
+#define percpu_variable_ptr(name) (&(name))
+
+/*
* Variant on the per-CPU variable declaration/definition theme used for
* ordinary per-CPU variables.
*/
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] percpu: add percpu_variable_ptr()
2010-06-23 10:04 [PATCH 1/2] percpu: add percpu_variable_ptr() Lai Jiangshan
@ 2010-06-23 10:07 ` Tejun Heo
2010-06-23 10:20 ` Lai Jiangshan
0 siblings, 1 reply; 4+ messages in thread
From: Tejun Heo @ 2010-06-23 10:07 UTC (permalink / raw)
To: Lai Jiangshan; +Cc: Paul E. McKenney, Ingo Molnar, LKML
On 06/23/2010 12:04 PM, Lai Jiangshan wrote:
> The percpu variable and allocated percpu data are compatible
> witch each other, This patch adds a API, thus we can use
> per_cpu_ptr() for defined/declared percpu variable.
>
> Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
> ---
> diff --git a/include/linux/percpu-defs.h b/include/linux/percpu-defs.h
> index ce2dc65..d5c8d7f 100644
> --- a/include/linux/percpu-defs.h
> +++ b/include/linux/percpu-defs.h
> @@ -81,6 +81,12 @@
> #endif
>
> /*
> + * Ptr of the declared/defined per-CPU variable.
> + * It is totally compatible with the return from alloc_percpu().
> + */
> +#define percpu_variable_ptr(name) (&(name))
Why not just use &name?
Thanks.
--
tejun
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] percpu: add percpu_variable_ptr()
2010-06-23 10:07 ` Tejun Heo
@ 2010-06-23 10:20 ` Lai Jiangshan
2010-06-23 10:22 ` Tejun Heo
0 siblings, 1 reply; 4+ messages in thread
From: Lai Jiangshan @ 2010-06-23 10:20 UTC (permalink / raw)
To: Tejun Heo; +Cc: Paul E. McKenney, Ingo Molnar, LKML
Tejun Heo wrote:
> On 06/23/2010 12:04 PM, Lai Jiangshan wrote:
>> The percpu variable and allocated percpu data are compatible
>> witch each other, This patch adds a API, thus we can use
>> per_cpu_ptr() for defined/declared percpu variable.
>>
>> Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
>> ---
>> diff --git a/include/linux/percpu-defs.h b/include/linux/percpu-defs.h
>> index ce2dc65..d5c8d7f 100644
>> --- a/include/linux/percpu-defs.h
>> +++ b/include/linux/percpu-defs.h
>> @@ -81,6 +81,12 @@
>> #endif
>>
>> /*
>> + * Ptr of the declared/defined per-CPU variable.
>> + * It is totally compatible with the return from alloc_percpu().
>> + */
>> +#define percpu_variable_ptr(name) (&(name))
>
> Why not just use &name?
>
I remember the real variable name is hidden.
We can't expose the inner details of percpu, so I add a macro for it.
Thanks,
Lai
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] percpu: add percpu_variable_ptr()
2010-06-23 10:20 ` Lai Jiangshan
@ 2010-06-23 10:22 ` Tejun Heo
0 siblings, 0 replies; 4+ messages in thread
From: Tejun Heo @ 2010-06-23 10:22 UTC (permalink / raw)
To: Lai Jiangshan; +Cc: Paul E. McKenney, Ingo Molnar, LKML
Hello,
On 06/23/2010 12:20 PM, Lai Jiangshan wrote:
>> Why not just use &name?
>
> I remember the real variable name is hidden.
> We can't expose the inner details of percpu, so I add a macro for it.
Yeah, the whole point was unifying static and dynamic ones into the
same name / address space. &name is now guaranteed to work, so no
need for indirection layer.
Thanks.
--
tejun
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2010-06-23 10:23 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-23 10:04 [PATCH 1/2] percpu: add percpu_variable_ptr() Lai Jiangshan
2010-06-23 10:07 ` Tejun Heo
2010-06-23 10:20 ` Lai Jiangshan
2010-06-23 10:22 ` Tejun Heo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox