Re: [patch] kmalloc_percpu -- 2 of 2

Dipankar Sarma (dipankar@in.ibm.com)
Thu, 5 Dec 2002 09:12:17 +0530


On Wed, Dec 04, 2002 at 11:34:35AM -0800, Andrew Morton wrote:
> > +/* Use these with kmalloc_percpu */
> > +#define get_cpu_ptr(ptr) per_cpu_ptr(ptr, get_cpu())
> > +#define put_cpu_ptr(ptr) put_cpu()
>
> These names sound very much like get_cpu_var() and put_cpu_var(),
> yet they are using a quite different subsystem. It would be good
> to choose something more distinct. Not that I can think of anything
> at present ;)

Well, they are similar, aren't they ? get_cpu_ptr() can just be thought
of as the dynamic twin of get_cpu_var(). So, in that sense it seems ok
to me.

>
> If we were to remove the percpu_interlaced_alloc() leg here, we'd
> have a nice, simple per-cpu kmalloc implementation.
>
> Could you please explain what all the other code is there for?

The interlaced allocator allows you to save space when kmalloc_percpu()
is used to allocate small objects. That is done by interlacing each
CPU's copy of the objects just like the static per-cpu data area.

Thanks

-- 
Dipankar Sarma  <dipankar@in.ibm.com> http://lse.sourceforge.net
Linux Technology Center, IBM Software Lab, Bangalore, India.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/