From: Peter Zijlstra <peterz@infradead.org>
To: Nicholas Mc Guire <der.herr@hofr.at>
Cc: Steven Rostedt <rostedt@goodmis.org>,
Joel Fernandes <agnel.joel@gmail.com>,
Greg Kroah-Hartman <greg@kroah.com>,
linux-rt-users@vger.kernel.org,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
kernelnewbies <kernelnewbies@nl.linux.org>,
Ingo Molnar <mingo@redhat.com>,
Thomas Gleixner <tglx@linutronix.de>
Subject: Re: RFC on fixing mutex spinning on owner
Date: Thu, 17 Mar 2016 11:18:23 +0100 [thread overview]
Message-ID: <20160317101823.GQ6344@twins.programming.kicks-ass.net> (raw)
In-Reply-To: <20160317080526.GB6679@osadl.at>
On Thu, Mar 17, 2016 at 08:05:26AM +0000, Nicholas Mc Guire wrote:
> scanning for that patter with a quite relaxed spatch did not
> turn up more than a hand full:
>
> @resched_spin exists@
> position p;
> @@
>
> (
> * while@p (...) {
> ...
> if (need_resched() || ...)
> break;
> ...
> \(cpu_relax\|cpu_relax_lowlatency\)();
> }
> |
> * while@p (!need_resched()) {
> ...
> \(cpu_relax\|cpu_relax_lowlatency\)();
> }
> )
>
> @script:python@
> p << resched_spin.p;
> @@
> print "%s:%s " % (p[0].file,p[0].line)
>
>
> is this making some wrong assumptions here or is this
> really so infrequent ?
Ah, a tool, nice! :-)
There should be one in the osq_lock, one in mutex, one in rwsem-xadd,
davidlohr was adding one to rt_mutex; and these are the one I can
remember from the top of my head.
But I would not be surprised if there are a fair few more. Also for (;;)
is a frequent loop pattern.
My biggest worry is how to not forget adding this annotation if we
create yet another instance of this. The tool could help I suppose.
Also, maybe the tracer should measure the time from need_resched()
getting true until the next preemption point, instead of the entire time
preemption was disabled. Which would avoid the entire issue altogether.
next prev parent reply other threads:[~2016-03-17 10:18 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-16 23:22 RFC on fixing mutex spinning on owner Joel Fernandes
2016-03-16 23:35 ` Greg Kroah-Hartman
2016-03-16 23:38 ` Joel Fernandes
2016-03-17 2:17 ` Steven Rostedt
2016-03-17 5:35 ` Joel Fernandes
2016-03-17 12:08 ` Steven Rostedt
2016-03-17 7:36 ` Peter Zijlstra
2016-03-17 8:05 ` Nicholas Mc Guire
2016-03-17 10:18 ` Peter Zijlstra [this message]
2016-03-17 11:16 ` Thomas Gleixner
2016-03-17 12:06 ` Steven Rostedt
2016-03-17 12:13 ` Peter Zijlstra
2016-03-17 13:32 ` Thomas Gleixner
2016-03-17 15:36 ` Nicholas Mc Guire
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=20160317101823.GQ6344@twins.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=agnel.joel@gmail.com \
--cc=der.herr@hofr.at \
--cc=greg@kroah.com \
--cc=kernelnewbies@nl.linux.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rt-users@vger.kernel.org \
--cc=mingo@redhat.com \
--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