linux-rt-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Gregory Haskins <ghaskins@novell.com>
To: mingo@elte.hu, paulmck@linux.vnet.ibm.com, peterz@infradead.org,
	tglx@linutronix.de, rostedt@goodmis.org
Cc: linux-kernel@vger.kernel.org, linux-rt-users@vger.kernel.org,
	gregory.haskins@gmail.com, David.Holmes@sun.com,
	jkacur@gmail.com
Subject: [PATCH RT RFC v4 0/8] Priority Inheritance enhancements
Date: Fri, 15 Aug 2008 16:28:18 -0400	[thread overview]
Message-ID: <20080815202408.668.23736.stgit@dev.haskins.net> (raw)
In-Reply-To: <20080801210945.3469.1183.stgit@lsg.lsg.lab.novell.com>

** RFC for PREEMPT_RT branch, 26-rt1 **

Synopsis: We gain a 13%+ IO improvement in the PREEMPT_RT kernel by
re-working some of the PI logic.

[
	Changelog:

	v4:

		1) Incorporated review comments

		   *) Fixed checkpatch warning about extern in .c
		   *) Renamed s/snk/sink
		   *) Renamed s/addref/get
		   *) Renamed s/dropref/put
		   *) Made pi_sink use static *ops

		2) Fixed a bug w.r.t. enabling interrupts too early  

	v3:

		*) fixed a race with sinkref->prio

	v2:

		*) Added proper reference counting to prevent tasks from
	   	   deleting while a node->update() is still in flight
		*) unified the RCU boost path

	v1:

		*) initial release
]


[
	fyi -> you can find this series at the following URLs in
	addition to this thread:

  		 http://git.kernel.org/?p=linux/kernel/git/ghaskins/linux-2.6-hacks.git;a=shortlog;h=pi-rework

  		 ftp://ftp.novell.com/dev/ghaskins/pi-rework.tar.bz2

]

Hi All,

The following series applies to 26-rt1 as a request-for-comment on a 
new approach to priority-inheritance (PI), as well as some performance
enhancements to take advantage of those new approaches.  This yields at
least a 13-15% improvement for diskio on my 4-way x86_64 system.  An
8-way system saw as much as 700% improvement during early testing, but
I have not recently reconfirmed this number.

Motivation for series:

I have several ideas on things we can do to enhance and improve kernel
performance with respect to PREEMPT_RT

1) For instance, it would be nice to support priority queuing and
   (at least positional) inheritance in the wait-queue infrastructure.

2) Reducing overhead in the real-time locks (sleepable replacements for
   spinlock_t in PREEMPT_RT) to try to approach the minimal overhead
   if their non-rt equivalent.  We have determined via instrumentation
   that one area of major overhead is the pi-boost logic.

However, today the PI code is entwined in the rtmutex infrastructure,
yet we require more flexibility if we want to address (1) and (2)
above.  Therefore the first step is to separate the PI code away from
rtmutex into its own library (libpi). This is covered in patches 1-7.

(I realize patch #7 is a little hard to review since I removed and added
a lot of code that the unified diff is all mashing together...I will try
to find a way to make this more readable).

Patch 8 is the first real consumer of the libpi logic to try to enhance
performance.  It accomplishes this by deferring pi-boosting a lock
owner unless it is absolutely necessary.  Since instrumentation
shows that the majority of locks are acquired either via the fast-path,
or via the adaptive-spin path, we can eliminate most of the pi-overhead
with this technique.  This yields a measurable performance gain (at least
13% for workloads with heavy lock contention was observed in our lab).

We have not yet completed the work on the pi-waitqueues or any of the other
related pi enhancements.  Those will be coming in a follow-on announcement.

Feedback/comments welcome!

Regards,
-Greg


---

Gregory Haskins (8):
      rtmutex: pi-boost locks as late as possible
      rtmutex: convert rtmutexes to fully use the PI library
      rtmutex: use runtime init for rtmutexes
      RT: wrap the rt_rwlock "add reader" logic
      rtmutex: formally initialize the rt_mutex_waiters
      sched: rework task reference counting to work with the pi infrastructure
      sched: add the basic PI infrastructure to the task_struct
      add generalized priority-inheritance interface


 Documentation/libpi.txt   |   59 ++
 include/linux/pi.h        |  278 +++++++++++
 include/linux/rt_lock.h   |    2 
 include/linux/rtmutex.h   |   18 -
 include/linux/sched.h     |   57 +-
 include/linux/workqueue.h |    2 
 kernel/fork.c             |   35 +
 kernel/rcupreempt-boost.c |   25 -
 kernel/rtmutex-debug.c    |    4 
 kernel/rtmutex-tester.c   |    4 
 kernel/rtmutex.c          | 1091 ++++++++++++++++++---------------------------
 kernel/rtmutex_common.h   |   19 -
 kernel/rwlock_torture.c   |   32 -
 kernel/sched.c            |  209 ++++++---
 kernel/workqueue.c        |   39 +-
 lib/Makefile              |    3 
 lib/pi.c                  |  516 +++++++++++++++++++++
 17 files changed, 1543 insertions(+), 850 deletions(-)
 create mode 100644 Documentation/libpi.txt
 create mode 100644 include/linux/pi.h
 create mode 100644 lib/pi.c




---

Gregory Haskins (8):
      rtmutex: pi-boost locks as late as possible
      rtmutex: convert rtmutexes to fully use the PI library
      rtmutex: use runtime init for rtmutexes
      RT: wrap the rt_rwlock "add reader" logic
      rtmutex: formally initialize the rt_mutex_waiters
      sched: rework task reference counting to work with the pi infrastructure
      sched: add the basic PI infrastructure to the task_struct
      add generalized priority-inheritance interface


 Documentation/libpi.txt   |   59 ++
 include/linux/pi.h        |  293 ++++++++++++
 include/linux/rt_lock.h   |    2 
 include/linux/rtmutex.h   |   18 -
 include/linux/sched.h     |   59 +-
 include/linux/workqueue.h |    2 
 kernel/fork.c             |   35 +
 kernel/rcupreempt-boost.c |   25 -
 kernel/rtmutex-debug.c    |    4 
 kernel/rtmutex-tester.c   |    4 
 kernel/rtmutex.c          | 1091 ++++++++++++++++++---------------------------
 kernel/rtmutex_common.h   |   19 -
 kernel/rwlock_torture.c   |   32 -
 kernel/sched.c            |  207 ++++++---
 kernel/workqueue.c        |   39 +-
 lib/Makefile              |    3 
 lib/pi.c                  |  489 ++++++++++++++++++++
 17 files changed, 1531 insertions(+), 850 deletions(-)
 create mode 100644 Documentation/libpi.txt
 create mode 100644 include/linux/pi.h
 create mode 100644 lib/pi.c

-- 
Signature

  parent reply	other threads:[~2008-08-15 20:30 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-01 21:16 [PATCH RT RFC 0/7] Priority Inheritance enhancements Gregory Haskins
2008-08-01 21:16 ` [PATCH RT RFC 1/7] add generalized priority-inheritance interface Gregory Haskins
2008-08-01 21:16 ` [PATCH RT RFC 2/7] sched: add the basic PI infrastructure to the task_struct Gregory Haskins
2008-08-01 21:17 ` [PATCH RT RFC 3/7] rtmutex: formally initialize the rt_mutex_waiters Gregory Haskins
2008-08-01 21:17 ` [PATCH RT RFC 4/7] RT: wrap the rt_rwlock "add reader" logic Gregory Haskins
2008-08-01 21:17 ` [PATCH RT RFC 5/7] rtmutex: use runtime init for rtmutexes Gregory Haskins
2008-08-01 21:17 ` [PATCH RT RFC 6/7] rtmutex: convert rtmutexes to fully use the PI library Gregory Haskins
2008-08-01 21:17 ` [PATCH RT RFC 7/7] rtmutex: pi-boost locks as late as possible Gregory Haskins
2008-08-04 13:21   ` Gregory Haskins
2008-08-05  3:01     ` Gregory Haskins
2008-08-15 12:08 ` [PATCH RT RFC v2 0/8] Priority Inheritance enhancements Gregory Haskins
2008-08-15 12:08   ` [PATCH RT RFC v2 1/8] add generalized priority-inheritance interface Gregory Haskins
2008-08-15 13:16     ` [PATCH RT RFC v3] " Gregory Haskins
2008-08-15 12:08   ` [PATCH RT RFC v2 2/8] sched: add the basic PI infrastructure to the task_struct Gregory Haskins
2008-08-15 12:08   ` [PATCH RT RFC v2 3/8] sched: rework task reference counting to work with the pi infrastructure Gregory Haskins
2008-08-15 12:08   ` [PATCH RT RFC v2 4/8] rtmutex: formally initialize the rt_mutex_waiters Gregory Haskins
2008-08-15 12:08   ` [PATCH RT RFC v2 5/8] RT: wrap the rt_rwlock "add reader" logic Gregory Haskins
2008-08-15 12:08   ` [PATCH RT RFC v2 6/8] rtmutex: use runtime init for rtmutexes Gregory Haskins
2008-08-15 12:08   ` [PATCH RT RFC v2 7/8] rtmutex: convert rtmutexes to fully use the PI library Gregory Haskins
2008-08-15 12:08   ` [PATCH RT RFC v2 8/8] rtmutex: pi-boost locks as late as possible Gregory Haskins
2008-08-15 20:28 ` Gregory Haskins [this message]
2008-08-15 20:28   ` [PATCH RT RFC v4 1/8] add generalized priority-inheritance interface Gregory Haskins
2008-08-15 20:32     ` Gregory Haskins
2008-08-16 15:32     ` AW: " Matthias Behr
2008-08-19  8:34       ` Gregory Haskins
2008-08-16 19:56     ` Peter Zijlstra
2008-08-19  8:40       ` Gregory Haskins
2008-08-22 12:55     ` Esben Nielsen
2008-08-22 13:15       ` Gregory Haskins
2008-08-22 16:08         ` Gregory Haskins
2008-08-22 13:17       ` Steven Rostedt
2008-08-15 20:28   ` [PATCH RT RFC v4 2/8] sched: add the basic PI infrastructure to the task_struct Gregory Haskins
2008-08-15 20:28   ` [PATCH RT RFC v4 3/8] sched: rework task reference counting to work with the pi infrastructure Gregory Haskins
2008-08-15 20:28   ` [PATCH RT RFC v4 4/8] rtmutex: formally initialize the rt_mutex_waiters Gregory Haskins
2008-08-15 20:28   ` [PATCH RT RFC v4 5/8] RT: wrap the rt_rwlock "add reader" logic Gregory Haskins
2008-08-15 20:28   ` [PATCH RT RFC v4 6/8] rtmutex: use runtime init for rtmutexes Gregory Haskins
2008-08-15 20:28   ` [PATCH RT RFC v4 7/8] rtmutex: convert rtmutexes to fully use the PI library Gregory Haskins
2008-08-15 20:29   ` [PATCH RT RFC v4 8/8] rtmutex: pi-boost locks as late as possible Gregory Haskins

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=20080815202408.668.23736.stgit@dev.haskins.net \
    --to=ghaskins@novell.com \
    --cc=David.Holmes@sun.com \
    --cc=gregory.haskins@gmail.com \
    --cc=jkacur@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rt-users@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=paulmck@linux.vnet.ibm.com \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    /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;
as well as URLs for NNTP newsgroup(s).