Re: [PATCH v2] locking/pvqspinlock: Relax cmpxchg's to improve performance on some archs

From: Peter Zijlstra
Date: Thu Jan 05 2017 - 04:49:32 EST


On Thu, Jan 05, 2017 at 04:16:38PM +0800, Pan Xinhui wrote:
> I do some tests about cmpxchg and cmpxchg_acquire before on ppc.
>
> loops in 15s of each cmpxchg is below.
>
> cmpxchg_relaxed: 336663
> cmpxchg_release: 369054
> cmpxchg_acquire: 363364
> cmpxchg: 179435
>
> so cmpxchg is really expensive than others.
> but I also have doubt about the cmpxchg_relaxed, it should be the cheapest, but from the tests, release/acquire are faster than it.

Right, curious about that relaxed one. In any case, I was more wondering
about the performance impact on the larger construct of the pvlock
itself.