linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH 0/3] arm64: queued spinlocks and rw-locks
@ 2017-04-10 21:35 Yury Norov
  2017-04-10 21:35 ` [PATCH 1/3] kernel/locking: #include <asm/spinlock.h> in qrwlock.c Yury Norov
                   ` (3 more replies)
  0 siblings, 4 replies; 16+ messages in thread
From: Yury Norov @ 2017-04-10 21:35 UTC (permalink / raw)
  To: linux-kernel, linux-arch, linux-arm-kernel
  Cc: Yury Norov, Peter Zijlstra, Ingo Molnar, Arnd Bergmann,
	Catalin Marinas, Will Deacon, Jan Glauber

The patch of Jan Glauber enables queued spinlocks on arm64. I rebased it on
latest kernel sources, and added a couple of fixes to headers to apply it 
smoothly.

Though, locktourture test shows significant performance degradation in the
acquisition of rw-lock for read on qemu:

                          Before           After
spin_lock-torture:      38957034        37076367         -4.83
rw_lock-torture W:       5369471        18971957        253.33
rw_lock-torture R:       6413179         3668160        -42.80

I'm  not much experienced in locking, and so wonder how it's possible that
simple switching to generic queued rw-lock causes so significant performance
degradation, while in theory it should improve it. Even more, on x86 there
are no such problems probably.

I also think that patches 1 and 2 are correct and useful, and should be applied
anyway.

Any comments appreciated.

Yury.

Jan Glauber (1):
  arm64/locking: qspinlocks and qrwlocks support

Yury Norov (2):
  kernel/locking: #include <asm/spinlock.h> in qrwlock.c
  asm-generic: don't #include <linux/atomic.h> in qspinlock_types.h

 arch/arm64/Kconfig                      |  2 ++
 arch/arm64/include/asm/qrwlock.h        |  7 +++++++
 arch/arm64/include/asm/qspinlock.h      | 20 ++++++++++++++++++++
 arch/arm64/include/asm/spinlock.h       | 12 ++++++++++++
 arch/arm64/include/asm/spinlock_types.h | 14 +++++++++++---
 include/asm-generic/qspinlock.h         |  1 +
 include/asm-generic/qspinlock_types.h   |  8 --------
 kernel/locking/qrwlock.c                |  1 +
 8 files changed, 54 insertions(+), 11 deletions(-)
 create mode 100644 arch/arm64/include/asm/qrwlock.h
 create mode 100644 arch/arm64/include/asm/qspinlock.h

-- 
2.7.4

^ permalink raw reply	[flat|nested] 16+ messages in thread
* [PATCH 0/3] arm64: queued spinlocks and rw-locks
@ 2017-05-03 14:51 Yury Norov
  2017-05-03 14:51 ` [PATCH 2/3] asm-generic: don't #include <linux/atomic.h> in qspinlock_types.h Yury Norov
  0 siblings, 1 reply; 16+ messages in thread
From: Yury Norov @ 2017-05-03 14:51 UTC (permalink / raw)
  To: Will Deacon, Peter Zijlstra, linux-kernel, linux-arch, linux-arm-kernel
  Cc: Yury Norov, Adam Wallis, Andrew Pinski, Arnd Bergmann,
	Catalin Marinas, Ingo Molnar, Jan Glauber, Mark Rutland,
	Pan Xinhui

The patch 3 adds implementation for queued-based locking on
ARM64, and the option in kernel config to enable it. Patches
1 and 2 fix some mess in header files to apply patch 3 smoothly.

Tested on QDF2400 with huge improvements with these patches on
the torture tests, by Adam Wallis.

Tested on ThunderX, by Andrew Pinski:
120 thread (30 core - 4 thread/core) CN99xx (single socket):

benchmark               Units	qspinlocks vs ticket locks
sched/messaging		s	73.91%
sched/pipe		ops/s	104.18%
futex/hash		ops/s	103.87%
futex/wake		ms	71.04%
futex/wake-parallel	ms	93.88%
futex/requeue		ms	96.47%
futex/lock-pi		ops/s	118.33%

Notice, there's the queued locks implementation for the Power PC introduced
by Pan Xinhui. He largely tested it and also found significant performance
gain. In arch part it is very similar to this patch though.
https://lwn.net/Articles/701137/

RFC: https://www.spinics.net/lists/arm-kernel/msg575575.html
v1:
 - queued_spin_unlock_wait() and queued_spin_is_locked() are
   re-implemented in arch part to add additional memory barriers;
 - queued locks are made optional, ticket locks are enabled by default.

Jan Glauber (1):
  arm64/locking: qspinlocks and qrwlocks support

Yury Norov (2):
  kernel/locking: #include <asm/spinlock.h> in qrwlock.c
  asm-generic: don't #include <linux/atomic.h> in qspinlock_types.h

 arch/arm64/Kconfig                      | 24 +++++++++++++++++++
 arch/arm64/include/asm/qrwlock.h        |  7 ++++++
 arch/arm64/include/asm/qspinlock.h      | 42 +++++++++++++++++++++++++++++++++
 arch/arm64/include/asm/spinlock.h       | 12 ++++++++++
 arch/arm64/include/asm/spinlock_types.h | 14 ++++++++---
 arch/arm64/kernel/Makefile              |  1 +
 arch/arm64/kernel/qspinlock.c           | 34 ++++++++++++++++++++++++++
 include/asm-generic/qspinlock.h         |  1 +
 include/asm-generic/qspinlock_types.h   |  8 -------
 kernel/locking/qrwlock.c                |  1 +
 10 files changed, 133 insertions(+), 11 deletions(-)
 create mode 100644 arch/arm64/include/asm/qrwlock.h
 create mode 100644 arch/arm64/include/asm/qspinlock.h
 create mode 100644 arch/arm64/kernel/qspinlock.c

-- 
2.11.0

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2017-05-04  8:01 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-10 21:35 [RFC PATCH 0/3] arm64: queued spinlocks and rw-locks Yury Norov
2017-04-10 21:35 ` [PATCH 1/3] kernel/locking: #include <asm/spinlock.h> in qrwlock.c Yury Norov
2017-04-10 21:35 ` [PATCH 2/3] asm-generic: don't #include <linux/atomic.h> in qspinlock_types.h Yury Norov
2017-04-10 21:35 ` [PATCH 3/3] arm64/locking: qspinlocks and qrwlocks support Yury Norov
2017-04-13 18:12   ` Peter Zijlstra
2017-04-20 18:23     ` Yury Norov
2017-04-20 19:00       ` Mark Rutland
2017-04-20 19:05       ` Peter Zijlstra
2017-04-26 12:39         ` Yury Norov
2017-04-28 15:44           ` Will Deacon
2017-04-12 17:04 ` [RFC PATCH 0/3] arm64: queued spinlocks and rw-locks Adam Wallis
2017-04-13 10:33   ` Yury Norov
2017-04-28 15:37     ` Will Deacon
2017-04-24 13:36   ` Will Deacon
2017-05-03 14:51 [PATCH " Yury Norov
2017-05-03 14:51 ` [PATCH 2/3] asm-generic: don't #include <linux/atomic.h> in qspinlock_types.h Yury Norov
2017-05-04  8:01   ` Arnd Bergmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).