Re: [RFC PATCH 0/6 v2] Queued spinlocks/RW-locks for ARM

Will Deacon
2019-10-16T15:58:09Z

Hi Sebastian,

On Mon, Oct 14, 2019 at 12:13:04AM +0200, Sebastian Andrzej Siewior wrote:
> I added support for queued-RW and -spinlocks for ARM. I followed Arnd's
> suggestion and added support for xchg() on 8bit and 16bit variables (V6
> CPUs) via the SH implementation. This makes it possible to remove the
> current ticket based locking implementation.
>
> The numbers should be the same as in v1 posted here:
> http://lkml.kernel.org/r/20191007214439.27891-1-sebastian@breakpoint.cc
>
> The only thing changed is that patch #1-#3 wire up the missing xchg and
> the patches #4 and #5 additionally remove the old implementation while
> adding the missing bits for the queued implementation.

To be honest with you, I'm surprised that qspinlock is worth it for 32-bit
Arm. qrwlock makes sense because of fairness and starvation issues, but in
my benchmarks on arm64 tickets tended to perform at least as well for small
core counts, and I think that's largely going to be true for systems
running a 32-bit kernel.

I've uploaded my (crude, was never meant to be shared!) benchmark harness
here:

https://mirrors.edge.kernel.org/pub/linux/kernel/people/will/spinbench

which I used to generate graphs like:

https://mirrors.edge.kernel.org/pub/linux/kernel/people/will/slides/arm64-spinlocks.pdf

Maybe you could port it to 32-bit and see what the numbers look like? The
qspinlock code probably needs re-syncing with mainline too, but see how you
go. If it ends up being useful maybe I'll host it in a git tree.

Will