mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jason Low <jason.low2@hp.com>
To: Peter Zijlstra <peterz@infradead.org>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>,
	Ingo Molnar <mingo@kernel.org>, Waiman Long <waiman.long@hp.com>,
	Davidlohr Bueso <davidlohr@hp.com>,
	linux-kernel@vger.kernel.org
Cc: Thomas Gleixner <tglx@linutronix.de>,
	Rik van Riel <riel@redhat.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	"H. Peter Anvin" <hpa@zytor.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	Tim Chen <tim.c.chen@linux.intel.com>,
	Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>,
	Aswin Chandramouleeswaran <aswin@hp.com>,
	Scott Norton <scott.norton@hp.com>,
	Dave Chinner <david@fromorbit.com>, Jason Low <jason.low2@hp.com>
Subject: [PATCH v2 0/5] MCS spinlocks: Cancellable MCS spinlock rework
Date: Mon, 14 Jul 2014 10:27:47 -0700	[thread overview]
Message-ID: <1405358872-3732-1-git-send-email-jason.low2@hp.com> (raw)

v1->v2:
- Added a patch which uses function + macro for initializing the osq lock
  as suggested by Steven.
- Improved the way we initialize struct rw_semaphore fields with the
  init macro in patch 5 as suggested by Peter.

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 (5):
  MCS spinlocks: Rename optimistic_spin_queue to optimistic_spin_node
  MCS spinlocks: Convert osq lock to atomic_t to reduce overhead
  MCS spinlocks: Introduce and use init macro and function for osq
    locks
  MCS spinlocks: Micro-optimize osq_unlock()
  rwsem: Reduce the size of struct rw_semaphore

 include/linux/mutex.h         |    4 +-
 include/linux/osq_lock.h      |   27 +++++++++++++++++
 include/linux/rwsem.h         |   28 +++++++----------
 kernel/locking/mcs_spinlock.c |   64 ++++++++++++++++++++++++++++++----------
 kernel/locking/mcs_spinlock.h |    9 +++--
 kernel/locking/mutex.c        |    2 +-
 kernel/locking/rwsem-xadd.c   |    2 +-
 7 files changed, 96 insertions(+), 40 deletions(-)
 create mode 100644 include/linux/osq_lock.h


             reply	other threads:[~2014-07-14 17:28 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-14 17:27 Jason Low [this message]
2014-07-14 17:27 ` [PATCH v2 1/5] MCS spinlocks: Rename optimistic_spin_queue to optimistic_spin_node Jason Low
2014-07-16 19:20   ` [tip:locking/urgent] locking/spinlocks/mcs: Rename optimistic_spin_queue() to optimistic_spin_node() tip-bot for Jason Low
2014-07-14 17:27 ` [PATCH v2 2/5] MCS spinlocks: Convert osq lock to atomic_t to reduce overhead Jason Low
2014-07-16 19:20   ` [tip:locking/urgent] locking/spinlocks/mcs: " tip-bot for Jason Low
2014-07-14 17:27 ` [PATCH v2 3/5] MCS spinlocks: Introduce and use init macro and function for osq locks Jason Low
2014-07-16 19:21   ` [tip:locking/urgent] locking/spinlocks/mcs: " tip-bot for Jason Low
2014-07-14 17:27 ` [PATCH v2 4/5] MCS spinlocks: Micro-optimize osq_unlock() Jason Low
2014-07-16 19:21   ` [tip:locking/urgent] locking/spinlocks/mcs: " tip-bot for Jason Low
2014-07-14 17:27 ` [PATCH v2 5/5] rwsem: Reduce the size of struct rw_semaphore Jason Low
2014-07-16 19:24   ` [tip:locking/urgent] locking/rwsem: " tip-bot for Jason Low

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1405358872-3732-1-git-send-email-jason.low2@hp.com \
    --to=jason.low2@hp.com \
    --cc=akpm@linux-foundation.org \
    --cc=aswin@hp.com \
    --cc=david@fromorbit.com \
    --cc=davidlohr@hp.com \
    --cc=hpa@zytor.com \
    --cc=konrad.wilk@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=paulmck@linux.vnet.ibm.com \
    --cc=peterz@infradead.org \
    --cc=riel@redhat.com \
    --cc=rostedt@goodmis.org \
    --cc=scott.norton@hp.com \
    --cc=tglx@linutronix.de \
    --cc=tim.c.chen@linux.intel.com \
    --cc=torvalds@linux-foundation.org \
    --cc=waiman.long@hp.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®