Re: [cpuops cmpxchg V1 2/4] x86: this_cpu_cmpxchg and this_cpu_xchgoperations

From: Christoph Lameter
Date: Thu Dec 09 2010 - 18:40:43 EST


On Wed, 8 Dec 2010, H. Peter Anvin wrote:

> On 12/08/2010 10:17 AM, Mathieu Desnoyers wrote:
> >
> > Hi Christoph,
> >
> > Can you show if this provides savings in terms of:
> >
> > - instruction cache footprint
> > - cycles required to run
> > - large-scale impact on the branch prediction buffers
> >
> > Given that this targets per-cpu data only, the additional impact on cache-line
> > exchange traffic of using cmpxchg over xchg (cache-line not grabbed as exclusive
> > by the initial read) should not really matter.
> >
> > I'm CCing Arjan and HPA, because they might have some interesting insight into
> > the performance impact of lock-prefixed xchg vs using local cmpxchg in a loop.
> >
>
> XCHG is always locked; it doesn't need the prefix. Unfortunately,
> unlike on the 8086 on modern processors locks have a real cost.

So should we use xchg or a loop using prefixless cmpxchg instead when
referring to per cpu data and requiring only per cpu atomicness?

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