Re: [patch 04/41] cpu ops: Core piece for generic atomic per cpu operations

Rusty Russell
2008-06-11T11:11:19Z

On Wednesday 11 June 2008 03:42:15 Christoph Lameter wrote:
> 1. The x86 implementation does not exist because the segment register has
> so far not been available on x86_64. So you could not do the solution.
> You need the zero basing. Then you can use per_xxx_add in cpu_inc.

Yes: for 64 bit x86, getting rid of the PDA or zero-basing is required.

> 2. The general solution created overhead that is often not needed. If we
> would have done vm event counters with local_t then we would have
> atomic overhead for each increment on f.e. IA64. That was not
> acceptable. cpu_alloc never falls back to atomic operations.

You can implement it either way. I've said that three times now. The current
generic one uses atomics, but preempt disable/enable is possible.

> 3. local_t is based on the atomic logic. But percpu handling is
> fundamentally different in that accesses without the special macros
> are okay provided you are in a non preemptible or irq context!
> A local_t declaration makes such accesses impossible.

Again, untrue. The interface is already there. So feel free to implement
__cpu_local_inc et al in terms of preempt enable and disable so it doesn't
need to use atomics.

> 4. The modeling of local_t on atomic_t limits it to 32bit!

Again wrong. And adding an exclamation mark doesn't make it true.

Rusty.