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

Sebastian Andrzej Siewior
2019-10-16T21:35:41Z

On 2019-10-16 13:45:13 [-0400], Waiman Long wrote:
> My own testing on qspinlocks in the past, at least on x86-64, is that it
> is comparable to ticket lock with one or 2 contending tasks if not
> better. When there are 3 contending tasks, qspinlock will then be a bit
> slower than ticket lock because the overhead of using the MCS node for
> queuing is showing up. Starting with 4 and more contending tasks,
> qspinlock starts to show its strength and performing better and better
> with more contending tasks.
>
> So if the target is 4 cores or less, there isn't too much to gain from
> using qspinlock. Lock function inlining probably has a bigger
> performance benefit here than switching to qspinlock. Just food for thought.

from my initial numbers:
|IMX6q
|~~~~~
|HZ_100 | PREEMPT_NONE | PREEMPT_VOLUNTARY | PREEMPT
|Ticket | 52.103 | 52.284 | 60.5681
|Q-locks | 54.1804 | 53.267 | 56.1914
|Q-locksI| 52.2985 | 49.398 | 56.7441
|
|AM572x
|~~~~~~
|HZ_100 | PREEMPT_NONE | PREEMPT_VOLUNTARY | PREEMPT
|Ticket | 42.3819 | 42.4821 | 43.2671
|Q-locks | 40.9141 | 40.0269 | 42.65
|Q-locksI| 40.0763 | 39.9101 | 40.7811

AM572x (Cortex-A15) has two CPUs, IMX6q (Cortex-A9) has four. Here on
AM572x q-locks gain ~3.5% (PREEMPT_NONE) without inlining. IMX6q
performs worse in the same category. However it performs better on
HZ_250 which I wouldn't expect.

> Cheers,
> Longman

Sebastian