From: Tejun Heo on
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(a)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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: Lai Jiangshan on
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(a)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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: Tejun Heo on
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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/