public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH RFC v2 0/2] qspinlock: Introducing a 4-byte queue spinlock
@ 2013-08-13 18:41 Waiman Long
  2013-08-13 18:41 ` [PATCH RFC v2 1/2] qspinlock: Introducing a 4-byte queue spinlock implementation Waiman Long
  0 siblings, 1 reply; 18+ messages in thread
From: Waiman Long @ 2013-08-13 18:41 UTC (permalink / raw)
  To: Thomas Gleixner, Ingo Molnar, H. Peter Anvin, Arnd Bergmann
  Cc: Waiman Long, linux-arch, x86, linux-kernel, Peter Zijlstra,
	Steven Rostedt, Andrew Morton, Greg Kroah-Hartman, Matt Fleming,
	Michel Lespinasse, Andi Kleen, Rik van Riel, Paul E. McKenney,
	Linus Torvalds, Raghavendra K T, George Spelvin, Harvey Harrison,
	Chandramouleeswaran, Aswin, Norton, Scott J

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 be used to 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 about the same performance as the ticket
spinlock in uncontended case. Its performance is better with moderate
to heavy contention. It may be slightly slower in light to moderate
level of lock contention where the queue depth is around 1-2. 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.

There is also an experimental option to allow lock stealing thus breaking
the FIFO guarantee of lock acquisition. However, performance usually goes
up with an unfair lock.

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.

Signed-off-by: Waiman Long <Waiman.Long@hp.com>

Waiman Long (2):
  qspinlock: Introducing a 4-byte queue spinlock implementation
  qspinlock x86: Enable x86 to use queue spinlock

 arch/x86/Kconfig                      |    3 +
 arch/x86/include/asm/spinlock.h       |    2 +
 arch/x86/include/asm/spinlock_types.h |    4 +
 arch/x86/kernel/paravirt-spinlocks.c  |   10 +
 include/asm-generic/qspinlock.h       |  207 +++++++++++++
 lib/Kconfig                           |   25 ++
 lib/Makefile                          |    1 +
 lib/qspinlock.c                       |  522 +++++++++++++++++++++++++++++++++
 8 files changed, 774 insertions(+), 0 deletions(-)
 create mode 100644 include/asm-generic/qspinlock.h
 create mode 100644 lib/qspinlock.c


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

end of thread, other threads:[~2013-08-30  8:16 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <15321377012704@web8h.yandex.ru>
2013-08-21  3:01 ` [PATCH RFC v2 1/2] qspinlock: Introducing a 4-byte queue spinlock implementation Waiman Long
2013-08-21 15:51   ` Alexander Fyodorov
2013-08-22  1:04     ` Waiman Long
2013-08-22 13:28       ` Alexander Fyodorov
2013-08-26 20:14         ` Waiman Long
2013-08-27 12:09           ` Alexander Fyodorov
     [not found]             ` <20130827091436.3d5971a0@gandalf.local.home>
2013-08-27 13:53               ` Peter Zijlstra
2013-08-28  1:21                 ` Paul E. McKenney
2013-08-28  8:19                   ` Peter Zijlstra
2013-08-28 12:59                     ` Steven Rostedt
2013-08-28 13:05                       ` Peter Zijlstra
2013-08-28 13:15                         ` Steven Rostedt
2013-08-28 13:37                           ` Peter Zijlstra
2013-08-29 15:24             ` Waiman Long
2013-08-29 17:03               ` Alexander Fyodorov
2013-08-30  3:16                 ` Waiman Long
2013-08-30  8:15                   ` Alexander Fyodorov
2013-08-13 18:41 [PATCH RFC v2 0/2] qspinlock: Introducing a 4-byte queue spinlock Waiman Long
2013-08-13 18:41 ` [PATCH RFC v2 1/2] qspinlock: Introducing a 4-byte queue spinlock implementation Waiman Long

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox