From: Peter Zijlstra <peterz@infradead.org>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: "H. Peter Anvin" <hpa@zytor.com>, Ingo Molnar <mingo@kernel.org>,
Thomas Gleixner <tglx@linutronix.de>,
Mike Galbraith <bitbucket@online.de>,
Andi Kleen <ak@linux.intel.com>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
arjan@linux.intel.com
Subject: Re: [RFC] per-cpu preempt_count
Date: Tue, 13 Aug 2013 10:39:06 +0200 [thread overview]
Message-ID: <20130813083906.GT27162@twins.programming.kicks-ass.net> (raw)
In-Reply-To: <CA+55aFwP0nXWJ3-YXCxZC3kCJ-5nVG7dEbqqJa-HF5pdEc+xsg@mail.gmail.com>
On Mon, Aug 12, 2013 at 11:53:25AM -0700, Linus Torvalds wrote:
> On Mon, Aug 12, 2013 at 10:51 AM, H. Peter Anvin <hpa@zytor.com> wrote:
> >
> > So we would have code looking something like:
> >
> > decl %fs:preempt_count
> > jnz 1f
> > cmpb $0,%fs:need_resched
> > je 1f
> > call __preempt_schedule
> > 1:
> >
> > It's a nontrivial amount of code, but would seem a fair bit better than
> > what we have now, at least.
>
> Well, we currently don't even bother checking the preempt count at
> all, and we just optimistically assume that we don't nest in the
> common case. The preempt count is then re-checked in
> __preempt_schedule, I think.
>
> Which sounds like a fair approach.
>
> So the code would be simplified to just
>
> decl %fs:preempt_count
> cmpb $0,%fs:need_resched
> jne .. unlikely branch that calls __preempt_schedule
>
> which is not horrible. Not *quite* as nice as just doing a single
> "decl+js", but hey, certainly better than what we have now.
OK, so doing per-cpu need_resched is a trivial patch except for the
mwait side of things. Then again, Arjan already asked for per-cpu
need_resched specifically for mwait so we might as well do that.
The only complication is that IIRC Arjan wants to stagger the mwait
cache-lines and we would very much like our preempt_count and
need_resched (and possible some other __switch_to related things) in the
same cacheline.
Afaict that'll yield a double indirect again :/
next prev parent reply other threads:[~2013-08-13 8:39 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-12 11:51 Peter Zijlstra
2013-08-12 17:35 ` Linus Torvalds
2013-08-12 17:51 ` H. Peter Anvin
2013-08-12 18:53 ` Linus Torvalds
2013-08-13 8:39 ` Peter Zijlstra [this message]
2013-08-12 17:58 ` Ingo Molnar
2013-08-12 19:00 ` Linus Torvalds
2013-08-12 20:44 ` H. Peter Anvin
2013-08-13 10:30 ` Ingo Molnar
2013-08-13 12:26 ` Peter Zijlstra
2013-08-13 15:39 ` Linus Torvalds
2013-08-13 15:56 ` Ingo Molnar
2013-08-13 16:26 ` Peter Zijlstra
2013-08-13 16:28 ` H. Peter Anvin
2013-08-13 16:29 ` Peter Zijlstra
2013-08-13 16:38 ` Linus Torvalds
2013-08-18 17:57 ` Paul E. McKenney
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=20130813083906.GT27162@twins.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=ak@linux.intel.com \
--cc=arjan@linux.intel.com \
--cc=bitbucket@online.de \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.org \
/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
Powered by JetHome