Re: [PATCH] percpu: add optimized generic percpu accessors

From: Christoph Lameter
Date: Tue Jan 27 2009 - 16:06:06 EST


On Tue, 27 Jan 2009, Tejun Heo wrote:

> > later). That's because they use TLB tricks for a static 64k per-cpu
> > area, but this doesn't scale. That might not be vital: abandoning
> > that trick will mean they can't optimise read_percpu/read_percpu_var
> > etc as much.

Why wont it scale? this is a separate TLB entry for each processor.

>
> Isn't something like the following possible?
>
> #define pcpu_read(ptr) \
> ({ \
> if (__builtin_constant_p(ptr) && \
> ptr >= PCPU_STATIC_START && ptr < PCPU_STATIC_END) \
> do 64k TLB trick for static pcpu; \
> else \
> do generic stuff; \
> })

The TLB trick is just to access the percpu data at a fixed base. I.e.
value = SHIFT_PERCPU_PTR(percpu_var, FIXED_ADDRESS);

--
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/