mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Brian Gerst <brgerst@gmail.com>
To: mingo@redhat.com, hpa@zytor.com, paulus@samba.org,
	acme@redhat.com, linux-kernel@vger.kernel.org,
	fweisbec@gmail.com, a.p.zijlstra@chello.nl, efault@gmx.de,
	tglx@linutronix.de, tim@klingt.org, mingo@elte.hu
Subject: Re: [tip:sched/core] sched, x86: Optimize branch hint in  __switch_to()
Date: Tue, 24 Nov 2009 12:28:18 -0500	[thread overview]
Message-ID: <73c1f2160911240928j69cbf65dx4a2747a06c7ca43d@mail.gmail.com> (raw)
In-Reply-To: <tip-a3a1de0c34de6f5f8332cd6151c46af7813c0fcb@git.kernel.org>

On Tue, Nov 24, 2009 at 11:57 AM, tip-bot for Tim Blechmann
<tim@klingt.org> wrote:
> Commit-ID:  a3a1de0c34de6f5f8332cd6151c46af7813c0fcb
> Gitweb:     http://git.kernel.org/tip/a3a1de0c34de6f5f8332cd6151c46af7813c0fcb
> Author:     Tim Blechmann <tim@klingt.org>
> AuthorDate: Tue, 24 Nov 2009 11:55:15 +0100
> Committer:  Ingo Molnar <mingo@elte.hu>
> CommitDate: Tue, 24 Nov 2009 12:20:04 +0100
>
> sched, x86: Optimize branch hint in __switch_to()
>
> Branch hint profiling on my nehalem machine showed 96%
> incorrect branch hints:
>
>  6548732 174664120  96 __switch_to                    process_64.c
>    406
>  6548745 174565593  96 __switch_to                    process_64.c
>    410
>
> Signed-off-by: Tim Blechmann <tim@klingt.org>
> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
> Cc: Mike Galbraith <efault@gmx.de>
> Cc: Paul Mackerras <paulus@samba.org>
> Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
> Cc: Frederic Weisbecker <fweisbec@gmail.com>
> LKML-Reference: <4B0BBB93.3080307@klingt.org>
> Signed-off-by: Ingo Molnar <mingo@elte.hu>
> ---
>  arch/x86/kernel/process_64.c |    5 ++---
>  1 files changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c
> index ad535b6..d9db104 100644
> --- a/arch/x86/kernel/process_64.c
> +++ b/arch/x86/kernel/process_64.c
> @@ -406,11 +406,10 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p)
>         * This won't pick up thread selector changes, but I guess that is ok.
>         */
>        savesegment(es, prev->es);
> -       if (unlikely(next->es | prev->es))
> +       if (next->es | prev->es)
>                loadsegment(es, next->es);
> -
>        savesegment(ds, prev->ds);
> -       if (unlikely(next->ds | prev->ds))
> +       if (next->ds | prev->ds)
>                loadsegment(ds, next->ds);
>
>

64-bit tasks should have %ds and %es set to null selectors.  The only
time they should be different is for 32-bit tasks.  It lookx like some
versions of GCC just aren't using the hint.  I've tested it with 4.4.2
and the generated assembly is the same with or without the hint.

--
Brian Gerst

  reply	other threads:[~2009-11-24 17:28 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <cover.1259059549.git.tim@klingt.org>
2009-11-24 10:55 ` [PATCH 1/5] process_64: remove branch hint Tim Blechmann
2009-11-24 16:57   ` [tip:sched/core] sched, x86: Optimize branch hint in __switch_to() tip-bot for Tim Blechmann
2009-11-24 17:28     ` Brian Gerst [this message]
2009-11-25  9:03       ` Tim Blechmann
2009-11-25 15:53         ` Brian Gerst
2009-11-25 16:16           ` index 780cd92..22db86a 100644 Brian Gerst
2009-11-25 16:17           ` [PATCH] x86, 64-bit: Set data segments to null after switching to 64-bit mode Brian Gerst
2009-11-26  9:56             ` [tip:x86/asm] " tip-bot for Brian Gerst
2009-11-29 11:44             ` [PATCH] " Tim Blechmann
2009-12-02 11:32     ` [PATCH] Revert "sched, x86: Optimize branch hint in __switch_to()" Tim Blechmann
2009-12-02 13:27       ` [tip:sched/core] " tip-bot for Tim Blechmann
2009-11-24 10:55 ` [PATCH 2/5] sched.c: change branch hint Tim Blechmann
2009-11-24 16:56   ` [tip:sched/core] sched: Optimize branch hint in context_switch() tip-bot for Tim Blechmann
2009-11-24 10:55 ` [PATCH 3/5] slab.c: remove branch hint Tim Blechmann
2009-11-24 11:20   ` Ingo Molnar
2009-11-24 11:28     ` Pekka Enberg
2009-11-24 11:42       ` Ingo Molnar
2009-11-25 10:41         ` Pekka Enberg
2009-11-24 11:45       ` Tim Blechmann
2009-11-29 11:36       ` Tim Blechmann
2009-11-30  9:05         ` Pekka Enberg
2009-11-30 16:09           ` Christoph Lameter
2009-11-30 17:44             ` Pekka Enberg
2009-11-30 17:50               ` Christoph Lameter
2009-11-30 17:59               ` [PATCH] branch profiling on my nehalem machine showed 99% incorrect branch hints: Tim Blechmann
2009-12-06  8:33                 ` Pekka Enberg
2009-11-24 10:55 ` [PATCH 4/5] sched_fair.c: remove branch hint Tim Blechmann
2009-11-24 16:56   ` [tip:sched/core] sched: Optimize branch hint in pick_next_task_fair() tip-bot for Tim Blechmann
2009-11-24 10:55 ` [PATCH 5/5] workqueue.c: remove branch hint Tim Blechmann

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=73c1f2160911240928j69cbf65dx4a2747a06c7ca43d@mail.gmail.com \
    --to=brgerst@gmail.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@redhat.com \
    --cc=efault@gmx.de \
    --cc=fweisbec@gmail.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=mingo@redhat.com \
    --cc=paulus@samba.org \
    --cc=tglx@linutronix.de \
    --cc=tim@klingt.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

all inboxes | Powered by JetHome®