From: Tim Blechmann <tim@klingt.org>
To: Peter Zijlstra <a.p.zijlstra@chello.nl>,
linux-kernel@vger.kernel.org,
Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@elte.hu>, Thomas Gleixner <tglx@linutronix.de>
Subject: [PATCH] sched: Optimize branch hint in context_switch()
Date: Sun, 29 Nov 2009 13:01:48 +0100 [thread overview]
Message-ID: <4B1262AC.8000903@klingt.org> (raw)
[-- Attachment #1.1: Type: text/plain, Size: 385 bytes --]
Branch hint profiling on my nehalem machine showed 88%
incorrect branch hints:
42017484 326957902 88 context_switch sched.c 3043
42038493 326953687 88 context_switch sched.c 3050
Signed-off-by: Tim Blechmann <tim@klingt.org>
---
kernel/sched.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: 0001-sched-Optimize-branch-hint-in-context_switch.patch --]
[-- Type: text/x-patch; name="0001-sched-Optimize-branch-hint-in-context_switch.patch", Size: 553 bytes --]
diff --git a/kernel/sched.c b/kernel/sched.c
index 2a78b38..c78dcfe 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -3040,14 +3040,14 @@ context_switch(struct rq *rq, struct task_struct *prev,
*/
arch_start_context_switch(prev);
- if (likely(!mm)) {
+ if (unlikely(!mm)) {
next->active_mm = oldmm;
atomic_inc(&oldmm->mm_count);
enter_lazy_tlb(oldmm, next);
} else
switch_mm(oldmm, mm, next);
- if (likely(!prev->mm)) {
+ if (unlikely(!prev->mm)) {
prev->active_mm = NULL;
rq->prev_mm = oldmm;
}
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 197 bytes --]
next reply other threads:[~2009-11-29 12:05 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-29 12:01 Tim Blechmann [this message]
2009-11-29 15:12 ` [PATCH] sched: Optimize branch hint in context_switch() Avi Kivity
2009-11-29 15:20 ` Peter Zijlstra
2009-11-29 15:25 ` Avi Kivity
2009-11-29 16:02 ` Tim Blechmann
2009-11-30 9:25 ` Christian Borntraeger
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=4B1262AC.8000903@klingt.org \
--to=tim@klingt.org \
--cc=a.p.zijlstra@chello.nl \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=peterz@infradead.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.