Re: [my_cpu_ptr 1/5] Introduce my_cpu_ptr()

From: Rusty Russell
Date: Thu May 28 2009 - 21:27:40 EST


On Fri, 29 May 2009 01:29:31 am Christoph Lameter wrote:
> On Thu, 28 May 2009, Rusty Russell wrote:
> > On Thu, 28 May 2009 03:16:59 am cl@xxxxxxxxxxxxxxxxxxxx wrote:
> > > my_cpu_ptr(xx) = per_cpu_ptr(xx, smp_processor_id).
> >
> > I had this implemented earlier as as get_cpu_ptr()/__get_cpu_ptr(), to
> > match get_cpu_var() / __get_cpu_var().
>
> Have not seen it but it would be a bit confusing since
> we already have get_cpu* which must be paired with put_cpu*
> because of the refcount taking (get_cpu_var and get_cpu).
> get_cpu_ptr() would not have to be paired.

To clarify, get_cpu_ptr() would be paired with put_cpu_ptr(). __get_cpu_ptr()
would be the "raw" one:

#define get_cpu_ptr(xx) per_cpu_ptr(xx, get_cpu())
#define __get_cpu_ptr(xx) per_cpu_ptr(xx, smp_processor_id())

> Better use a different name.
>
> my_cpu_ptr came from my_cpu_offset:

Yep, but that's not as widely exposed as get_cpu & get_cpu_var.

Cheers,
Rusty.
--
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/