All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v4 0/3] qspinlock: Introducing a 4-byte queue spinlock
@ 2014-02-17 20:41 Waiman Long
  2014-02-17 20:41 ` [PATCH v4 1/3] qspinlock: Introducing a 4-byte queue spinlock implementation Waiman Long
                   ` (3 more replies)
  0 siblings, 4 replies; 62+ messages in thread
From: Waiman Long @ 2014-02-17 20:41 UTC (permalink / raw)
  To: Thomas Gleixner, Ingo Molnar, H. Peter Anvin, Arnd Bergmann
  Cc: linux-arch, x86, linux-kernel, Peter Zijlstra, Steven Rostedt,
	Andrew Morton, Michel Lespinasse, Andi Kleen, Rik van Riel,
	Paul E. McKenney, Linus Torvalds, Raghavendra K T,
	George Spelvin, Tim Chen, Daniel J Blueman, Alexander Fyodorov,
	Aswin Chandramouleeswaran, Scott J Norton,
	Thavatchai Makphaibulchoke, Waiman Long

v3->v4:
 - Remove debugging code and fix a configuration error
 - Simplify the qspinlock structure and streamline the code to make it
   perform a bit better
 - Add an x86 version of asm/qspinlock.h for holding x86 specific
   optimization.
 - Add an optimized x86 code path for 2 contending tasks to improve
   low contention performance.

v2->v3:
 - Simplify the code by using numerous mode only without an unfair option.
 - Use the latest smp_load_acquire()/smp_store_release() barriers.
 - Move the queue spinlock code to kernel/locking.
 - Make the use of queue spinlock the default for x86-64 without user
   configuration.
 - Additional performance tuning.

v1->v2:
 - Add some more comments to document what the code does.
 - Add a numerous CPU mode to support >= 16K CPUs
 - Add a configuration option to allow lock stealing which can further
   improve performance in many cases.
 - Enable wakeup of queue head CPU at unlock time for non-numerous
   CPU mode.

This patch set introduces a queue-based spinlock implementation that
can replace the default ticket spinlock without increasing the size
of the spinlock data structure. As a result, critical kernel data
structures that embed spinlock won't increase in size and breaking
data alignments.

The queue spinlock has slight better performance than the ticket
spinlock in uncontended case. Its performance can be much better
with moderate to heavy contention.  This patch has the potential of
improving the performance of all the workloads that have moderate to
heavy spinlock contention.

The queue spinlock is especially suitable for NUMA machines with at
least 2 sockets, though noticeable performance benefit probably won't
show up in machines with less than 4 sockets.

The purpose of this patch set is not to solve any particular spinlock
contention problems. Those need to be solved by refactoring the code
to make more efficient use of the lock or finer granularity ones. The
main purpose is to make the lock contention problems more tolerable
until someone can spend the time and effort to fix them.

Waiman Long (3):
  qspinlock: Introducing a 4-byte queue spinlock implementation
  qspinlock, x86: Enable x86-64 to use queue spinlock
  qspinlock, x86: Add x86 specific optimization for 2 contending tasks

 arch/x86/Kconfig                      |    1 +
 arch/x86/include/asm/qspinlock.h      |  236 ++++++++++++++++++++++
 arch/x86/include/asm/spinlock.h       |    5 +
 arch/x86/include/asm/spinlock_types.h |    4 +
 include/asm-generic/qspinlock.h       |  122 ++++++++++++
 include/asm-generic/qspinlock_types.h |   55 +++++
 kernel/Kconfig.locks                  |    7 +
 kernel/locking/Makefile               |    1 +
 kernel/locking/qspinlock.c            |  353 +++++++++++++++++++++++++++++++++
 9 files changed, 784 insertions(+), 0 deletions(-)
 create mode 100644 arch/x86/include/asm/qspinlock.h
 create mode 100644 include/asm-generic/qspinlock.h
 create mode 100644 include/asm-generic/qspinlock_types.h
 create mode 100644 kernel/locking/qspinlock.c


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

end of thread, other threads:[~2014-02-25  3:37 UTC | newest]

Thread overview: 62+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-17 20:41 [PATCH v4 0/3] qspinlock: Introducing a 4-byte queue spinlock Waiman Long
2014-02-17 20:41 ` [PATCH v4 1/3] qspinlock: Introducing a 4-byte queue spinlock implementation Waiman Long
2014-02-17 22:45   ` [tip:x86/spinlocks] " tip-bot for Waiman Long
2014-02-18  7:30   ` [PATCH v4 1/3] " Peter Zijlstra
2014-02-18 19:29     ` Waiman Long
2014-02-18  7:33   ` Peter Zijlstra
2014-02-18 19:31     ` Waiman Long
2014-02-18  7:39   ` Peter Zijlstra
2014-02-18 19:39     ` Waiman Long
2014-02-18 21:34       ` Peter Zijlstra
2014-02-19  0:50         ` Waiman Long
2014-02-19  8:52           ` Peter Zijlstra
2014-02-19 19:26             ` Waiman Long
2014-02-18 21:37       ` Peter Zijlstra
2014-02-19  0:58         ` Waiman Long
2014-02-19  8:55           ` Peter Zijlstra
2014-02-19 19:30             ` Waiman Long
2014-02-17 20:41 ` [PATCH v4 2/3] qspinlock, x86: Enable x86-64 to use queue spinlock Waiman Long
2014-02-17 22:46   ` [tip:x86/spinlocks] " tip-bot for Waiman Long
2014-02-17 20:41 ` [PATCH v4 3/3] qspinlock, x86: Add x86 specific optimization for 2 contending tasks Waiman Long
2014-02-17 22:46   ` [tip:x86/spinlocks] " tip-bot for Waiman Long
2014-02-21 12:12   ` [PATCH v4 3/3] " Peter Zijlstra
2014-02-21 17:08     ` Waiman Long
2014-02-21 17:09       ` Waiman Long
2014-02-21 17:26         ` Peter Zijlstra
2014-02-22  1:36           ` Waiman Long
2014-02-21 17:28   ` Peter Zijlstra
2014-02-22  1:39     ` Waiman Long
2014-02-17 22:47 ` [PATCH v4 0/3] qspinlock: Introducing a 4-byte queue spinlock H. Peter Anvin
2014-02-18  7:31   ` Peter Zijlstra
2014-02-18  7:39     ` H. Peter Anvin
2014-02-18 19:30     ` Waiman Long
2014-02-18 21:28       ` Peter Zijlstra
2014-02-19  0:42         ` Waiman Long
2014-02-19  7:09           ` Raghavendra K T
2014-02-19  8:51           ` Peter Zijlstra
2014-02-19 19:24             ` Waiman Long
2014-02-19 19:48               ` Peter Zijlstra
2014-02-20 17:37                 ` Waiman Long
2014-02-20 17:44                   ` Linus Torvalds
2014-02-20 17:44                     ` Linus Torvalds
2014-02-20 18:15                   ` Peter Zijlstra
2014-02-19 20:17               ` Linus Torvalds
2014-02-19 20:17                 ` Linus Torvalds
2014-02-20 17:54                 ` Waiman Long
2014-02-20 17:54                   ` Waiman Long
2014-02-20 18:42                   ` Linus Torvalds
2014-02-20 18:42                     ` Linus Torvalds
2014-02-20 19:21                     ` Waiman Long
2014-02-20 19:21                       ` Waiman Long
2014-02-20 19:32                   ` Raghavendra K T
2014-02-20 19:32                     ` Raghavendra K T
2014-02-21 17:02                     ` Waiman Long
2014-02-21 17:02                       ` Waiman Long
2014-02-21 17:05                       ` Linus Torvalds
2014-02-21 17:05                         ` Linus Torvalds
2014-02-19 21:29               ` H. Peter Anvin
2014-02-18  7:38   ` Peter Zijlstra
2014-02-22 16:56     ` Ingo Molnar
2014-02-25  3:37       ` Waiman Long
2014-02-25  3:37         ` Waiman Long
2014-02-18 19:27   ` Waiman Long

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.