Re: [cpuops cmpxchg V2 3/5] irq_work: Use per cpu atomics insteadof regular atomics

From: Christoph Lameter
Date: Wed Dec 15 2010 - 12:33:06 EST


On Wed, 15 Dec 2010, Peter Zijlstra wrote:

> > A prefix is one byte which is less that multiple arithmetic operations to
> > calculate an address.
>
> I thought you'd only need a single arithmetic op to calculate the
> address, anyway at some point those 1 byte prefixes will add up to more
> than the ops saved.

Yes if you have enough of those then it may no longer be worth it. But
here you only have two. And the segment address calculation is efficiently
implemented in the processors.

> Still, non of this is really fast-path code, so I really wonder why
> we're optimizing this over keeping the code obvious.

I was looking for usecases that already exist for cmpxchg (because the
patches introduce this_cpu_cmpxchg also for other uses) and found this one
here and it looked like an easy way to use the prefixed operation. Its
not that high of a priority but it seems that we are saving code and
cycles.

The code is cleaner IMHO. this_cpu_xx documents that the actions here
only have local effects and that there is no need of serialization with
other processors.

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