public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/4] MCS spinlocks: Cancellable MCS spinlock rework
@ 2014-07-07 18:50 Jason Low
  2014-07-07 18:50 ` [PATCH 1/4] MCS spinlocks: Rename optimistic_spin_queue to optimistic_spin_node Jason Low
                   ` (4 more replies)
  0 siblings, 5 replies; 9+ messages in thread
From: Jason Low @ 2014-07-07 18:50 UTC (permalink / raw)
  To: peterz, torvalds, paulmck, mingo, Waiman.Long, davidlohr,
	linux-kernel
  Cc: tglx, riel, rostedt, akpm, hpa, tim.c.chen, konrad.wilk, aswin,
	scott.norton, chegu_vinod, jason.low2

The main purpose of this patchset is to reduce the size of the
cancellable MCS spinlock and reduce the overhead of rwsem
(currently the largest lock in the kernel).

The overhead of the cancellable MCS lock is a pointer to a per-cpu  node
structure which requires 64 bits on 64 bit systems. Instead of a pointer
to the per-cpu node, we can instead store the CPU # corresponding to the
node in atomic_t. This reduces the overhead by 32 bits on 64 bit systems.

This then opens the opportunity to reduce the size of the rw_semaphore
structure (one of the current users of this MCS lock) by moving around some
of its fields. Due to padding, we would reduce the size of that structure
by 64 bits (on 64 bit systems). This makes it more in line with the size
of the mutex structure.

Jason Low (4):
  MCS spinlocks: Rename optimistic_spin_queue to optimistic_spin_node
  MCS spinlocks: Convert osq lock to atomic_t to reduce overhead
  MCS spinlocks: Micro-optimize osq_unlock()
  rwsem: Reduce the size of struct rw_semaphore

 include/linux/mutex.h         |    4 +-
 include/linux/osq_lock.h      |   19 ++++++++++++
 include/linux/rwsem.h         |   11 +++----
 kernel/locking/mcs_spinlock.c |   62 ++++++++++++++++++++++++++++++----------
 kernel/locking/mcs_spinlock.h |    9 +++--
 kernel/locking/mutex.c        |    2 +-
 kernel/locking/rwsem-xadd.c   |    2 +-
 7 files changed, 79 insertions(+), 30 deletions(-)
 create mode 100644 include/linux/osq_lock.h


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

end of thread, other threads:[~2014-07-11  9:29 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-07 18:50 [PATCH 0/4] MCS spinlocks: Cancellable MCS spinlock rework Jason Low
2014-07-07 18:50 ` [PATCH 1/4] MCS spinlocks: Rename optimistic_spin_queue to optimistic_spin_node Jason Low
2014-07-07 18:50 ` [PATCH 2/4] MCS spinlocks: Convert osq lock to atomic_t to reduce overhead Jason Low
2014-07-08 13:38   ` Steven Rostedt
2014-07-08 16:44     ` Jason Low
2014-07-07 18:50 ` [PATCH 3/4] MCS spinlocks: Micro-optimize osq_unlock() Jason Low
2014-07-07 18:50 ` [PATCH 4/4] rwsem: Reduce the size of struct rw_semaphore Jason Low
2014-07-11  9:29   ` Peter Zijlstra
2014-07-07 19:06 ` [PATCH 0/4] MCS spinlocks: Cancellable MCS spinlock rework Peter Zijlstra

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