From: Ingo Molnar <mingo@kernel.org>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
linux-rt-users <linux-rt-users@vger.kernel.org>,
Mike Galbraith <umgwanakikbuti@gmail.com>,
"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>,
Paul Gortmaker <paul.gortmaker@windriver.com>,
Thomas Gleixner <tglx@linutronix.de>,
Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
Clark Williams <williams@redhat.com>,
Frederic Weisbecker <fweisbec@gmail.com>,
Peter Zijlstra <peterz@infradead.org>
Subject: Re: [RFC PATCH RT] rwsem: The return of multi-reader PI rwsems
Date: Mon, 14 Apr 2014 11:55:54 +0200 [thread overview]
Message-ID: <20140414095554.GB731@gmail.com> (raw)
In-Reply-To: <20140409151922.5fa5d999@gandalf.local.home>
* Steven Rostedt <rostedt@goodmis.org> wrote:
> A while back ago I wrote a patch that would allow for reader/writer
> locks like rwlock and rwsems to have multiple readers in PREEMPT_RT. It
> was slick and fast but unfortunately it was way too complex and ridden
> with nasty little critters which earned me my large collection of
> frozen sharks in the fridge (which are quite tasty).
>
> The main problem with my previous solution was that I tried to be too
> clever. I worked hard on making the rw mutex still have the "fast
> path". That is, the cmpxchg that could allow a non contended grabbing
> of the lock be one instruction and be off with it. But to get that
> working required lots of tricks and black magic that was certainly
> going to fail. Thus, with the raining of sharks on my parade, the
> priority inheritance mutex with multiple owners died a slow painful
> death.
>
> So we thought.
>
> But over the years, a new darkness was on the horizon. Complaints about
> running highly threaded processes (did I hear Java?) were suffering
> huge performance hits on the PREEMPT_RT kernel. Whether or not the
> processes were real-time tasks, they still were horrible compared to
> running the same tasks on the mainline kernel. Note, this was being
> done on machines with many CPUs.
>
> The culprit mostly was a single rwsem, the notorious mmap_sem that
> can be taking several times for read, and as on RT, this is just a
> single mutex, and it would serialize these accesses that would not
> happen on mainline.
>
> I looked back at my poor dead rw multi pi reader patch and thought to
> myself. "How complex would this be if I removed the 'fast path' from
> the code". I decided to build a new tower in Mordor.
>
> I feel that I am correct. By removing the fast path and requiring all
> accesses to the rwsem to go through the slow path (must take the
> wait_lock to do anything). The code really wasn't that bad. I also only
> focused on the rwsem and did not worry about the rwlocks as that hasn't
> been pointed out as a bottle neck yet. If it does happen to be, this
> code could easily work on rwlocks too.
>
> I'm much more confident in this code than I was with my previous
> version of the rwlock multi-reader patch. I added a bunch of comments
> to this code to explain how things interact. The writer unlock was
> still able to use the fast path as the writers are pretty much like a
> normal mutex. Too bad that the writer unlock is not a high point of
> contention.
>
> This patch is built on top of the two other patches that I posted
> earlier, which should not be as controversial.
>
> If you have any benchmark on large machines I would be very happy if
> you could test this patch against the unpatched version of -rt.
>
> Cheers,
>
> -- Steve
>
> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
> ---
> Index: linux-rt.git/kernel/rtmutex.c
Side note: could you please in general include diffstats with such
patches, especially since you seem to be exporting it from a Git repo?
Newfangled patch summaries like:
include/linux/rtmutex.h | 29 ++
include/linux/rwsem_rt.h | 8
include/linux/sched.h | 20 +
kernel/fork.c | 20 +
kernel/futex.c | 2
kernel/rt.c | 27 +
kernel/rtmutex.c | 645 +++++++++++++++++++++++++++++++++++++++++++++--
kernel/rtmutex_common.h | 19 +
kernel/sysctl.c | 13
9 files changed, 753 insertions(+), 30 deletions(-)
Really give a useful bird's eye view of forest Fangorn, before
straying into it!
Thanks,
Ingo
next prev parent reply other threads:[~2014-04-14 9:55 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-09 19:19 [RFC PATCH RT] rwsem: The return of multi-reader PI rwsems Steven Rostedt
2014-04-10 14:18 ` Mike Galbraith
2014-04-10 14:28 ` Mike Galbraith
2014-04-10 14:32 ` Steven Rostedt
2014-04-11 2:50 ` Mike Galbraith
2014-04-11 3:25 ` Steven Rostedt
2014-04-11 3:52 ` Mike Galbraith
2014-04-11 4:25 ` Mike Galbraith
2014-04-10 14:44 ` Clark Williams
2014-04-10 15:01 ` Steven Rostedt
2014-04-10 15:03 ` Sebastian Andrzej Siewior
2014-04-10 15:36 ` Peter Zijlstra
2014-04-10 19:17 ` Steven Rostedt
2014-04-10 20:48 ` Peter Zijlstra
2014-04-10 21:30 ` Paul E. McKenney
2014-04-10 22:02 ` Steven Rostedt
2014-04-10 15:38 ` Steven Rostedt
2014-04-11 21:39 ` Daniel Bristot de Oliveira
2014-04-10 17:42 ` [RFC PATCH RT V2] " Steven Rostedt
2014-04-11 2:35 ` [RFC PATCH RT V3] " Steven Rostedt
2014-04-11 12:47 ` Carsten Emde
2014-04-11 13:25 ` Steven Rostedt
2014-04-17 23:26 ` [RFC PATCH RT V4] " Steven Rostedt
2014-04-18 8:19 ` Ingo Molnar
2014-04-24 17:52 ` Steven Rostedt
2014-04-14 9:55 ` Ingo Molnar [this message]
2014-04-14 13:34 ` [RFC PATCH RT] " Steven Rostedt
2014-04-14 14:08 ` Peter Zijlstra
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=20140414095554.GB731@gmail.com \
--to=mingo@kernel.org \
--cc=bigeasy@linutronix.de \
--cc=fweisbec@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rt-users@vger.kernel.org \
--cc=paul.gortmaker@windriver.com \
--cc=paulmck@linux.vnet.ibm.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=tglx@linutronix.de \
--cc=umgwanakikbuti@gmail.com \
--cc=williams@redhat.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;
as well as URLs for NNTP newsgroup(s).