linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jason Baron <jbaron@redhat.com>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Ingo Molnar <mingo@elte.hu>, "H. Peter Anvin" <hpa@zytor.com>,
	a.p.zijlstra@chello.nl, mathieu.desnoyers@efficios.com,
	davem@davemloft.net, ddaney.cavm@gmail.com,
	akpm@linux-foundation.org, linux-kernel@vger.kernel.org,
	Linus Torvalds <torvalds@linux-foundation.org>
Subject: Re: [PATCH 00/10] jump label: introduce very_[un]likely + cleanups + docs
Date: Wed, 22 Feb 2012 10:42:07 -0500	[thread overview]
Message-ID: <20120222154206.GA3405@redhat.com> (raw)
In-Reply-To: <1329923533.25686.106.camel@gandalf.stny.rr.com>

On Wed, Feb 22, 2012 at 10:12:13AM -0500, Steven Rostedt wrote:
> On Wed, 2012-02-22 at 15:56 +0100, Ingo Molnar wrote:
> 
> > > Because it really just looks like a stronger "unlikely()" and 
> > > fundamentally it really isn't. [...]
> > 
> > Well, the fact is that right now it *is* a stronger unlikely() 
> > on architectures that have jump-labels and it's mapped to 
> > unlikely() on others.
> > 
> 
> Has gcc been fix to make it truly an unlikely case and remove the "jmp;
> jmp" problem of before? I'm still using gcc 4.6.0 which has the
> following code for a tracepoint (example is the
> trace_sched_migrate_task().
> 
>     5b4a:       e9 00 00 00 00          jmpq   5b4f <set_task_cpu+0x5e>
> 
> The above is the jump label that turns into a nop at boot up.
> 
>     5b4f:       eb 19                   jmp    5b6a <set_task_cpu+0x79>
> 
> Here we jump over some of the trace code (this is the fast path)
> 
>     5b51:       49 8b 7d 08             mov    0x8(%r13),%rdi
>     5b55:       44 89 e2                mov    %r12d,%edx
>     5b58:       48 89 de                mov    %rbx,%rsi
>     5b5b:       41 ff 55 00             callq  *0x0(%r13)
>     5b5f:       49 83 c5 10             add    $0x10,%r13
>     5b63:       49 83 7d 00 00          cmpq   $0x0,0x0(%r13)
>     5b68:       eb 41                   jmp    5bab <set_task_cpu+0xba>
> 
> Below is the continuation of the fast path.
> 
>     5b6a:       48 8b 43 08             mov    0x8(%rbx),%rax
>     5b6e:       44 39 60 18             cmp    %r12d,0x18(%rax)
>     5b72:       74 0c                   je     5b80 <set_task_cpu+0x8f>
> 
> 
> Again, I'm using gcc 4.6.0 and maybe it has been fixed.
> 
> -- Steve
> 
> 

Hi Steve,

Using 4.6.2, I don't see the 'jmp;jmp' issue. I have:

ffffffff810610c0 <set_task_cpu>:
ffffffff810610c0:       55                      push   %rbp
ffffffff810610c1:       48 89 e5                mov    %rsp,%rbp
ffffffff810610c4:       48 81 ec e0 00 00 00    sub    $0xe0,%rsp
ffffffff810610cb:       48 89 5d d8             mov    %rbx,-0x28(%rbp)
ffffffff810610cf:       4c 89 65 e0             mov    %r12,-0x20(%rbp)
ffffffff810610d3:       48 89 fb                mov    %rdi,%rbx
ffffffff810610d6:       4c 89 6d e8             mov    %r13,-0x18(%rbp)
ffffffff810610da:       4c 89 75 f0             mov    %r14,-0x10(%rbp)
ffffffff810610de:       41 89 f4                mov    %esi,%r12d
ffffffff810610e1:       4c 89 7d f8             mov    %r15,-0x8(%rbp)

no double jump here.

ffffffff810610e5:       e9 00 00 00 00          jmpq   ffffffff810610ea <set_task_cpu+0x2a>
ffffffff810610ea:       48 8b 43 08             mov    0x8(%rbx),%rax
ffffffff810610ee:       44 3b 60 18             cmp    0x18(%rax),%r12d
ffffffff810610f2:       74 0d                   je     ffffffff81061101 <set_task_cpu+0x41>
ffffffff810610f4:       48 83 83 a8 00 00 00    addq   $0x1,0xa8(%rbx)
ffffffff810610fb:       01

no double jump here.

ffffffff810610fc:       e9 00 00 00 00          jmpq   ffffffff81061101 <set_task_cpu+0x41>
ffffffff81061101:       48 8b 83 60 06 00 00    mov    0x660(%rbx),%rax
ffffffff81061108:       48 8b 50 40             mov    0x40(%rax),%rdx
ffffffff8106110c:       44 89 e0                mov    %r12d,%eax
ffffffff8106110f:       48 8b 4a 28             mov    0x28(%rdx),%rcx
ffffffff81061113:       48 8b 0c c1             mov    (%rcx,%rax,8),%rcx
ffffffff81061117:       48 89 8b 90 01 00 00    mov    %rcx,0x190(%rbx)
ffffffff8106111e:       48 8b 52 20             mov    0x20(%rdx),%rdx
ffffffff81061122:       48 8b 04 c2             mov    (%rdx,%rax,8),%rax
ffffffff81061126:       48 89 83 88 01 00 00    mov    %rax,0x188(%rbx)
ffffffff8106112d:       48 8b 43 08             mov    0x8(%rbx),%rax
ffffffff81061131:       44 89 60 18             mov    %r12d,0x18(%rax)
ffffffff81061135:       48 8b 5d d8             mov    -0x28(%rbp),%rbx
ffffffff81061139:       4c 8b 65 e0             mov    -0x20(%rbp),%r12
ffffffff8106113d:       4c 8b 6d e8             mov    -0x18(%rbp),%r13
ffffffff81061141:       4c 8b 75 f0             mov    -0x10(%rbp),%r14
ffffffff81061145:       4c 8b 7d f8             mov    -0x8(%rbp),%r15
ffffffff81061149:       c9                      leaveq
ffffffff8106114a:       c3                      retq

....

Do you have 'CONFIG_CC_OPTIMIZE_FOR_SIZE' set?

Thanks,

-Jason

  parent reply	other threads:[~2012-02-22 15:42 UTC|newest]

Thread overview: 84+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-21 20:02 [PATCH 00/10] jump label: introduce very_[un]likely + cleanups + docs Jason Baron
2012-02-21 20:02 ` [PATCH 01/10] jump label: Add a WARN() if jump label key count goes negative Jason Baron
2012-02-29 10:13   ` [tip:perf/core] " tip-bot for Jason Baron
2012-02-21 20:02 ` [PATCH 02/10] jump label: fix compiler warning Jason Baron
2012-02-29 10:14   ` [tip:perf/core] jump label: Fix " tip-bot for Jason Baron
2012-02-21 20:03 ` [PATCH 03/10] jump label: introduce very_unlikely() Jason Baron
2012-02-21 20:03 ` [PATCH 04/10] jump label: introduce very_likely() Jason Baron
2012-02-21 20:03 ` [PATCH 05/10] perf: update to use 'very_unlikely()' Jason Baron
2012-02-21 20:03 ` [PATCH 06/10] tracepoints: update to use very_unlikely() Jason Baron
2012-02-21 20:03 ` [PATCH 07/10] sched: update to use very_[un]likely() Jason Baron
2012-02-21 20:03 ` [PATCH 08/10] kvm: update to use very_unlikely() Jason Baron
2012-02-21 20:03 ` [PATCH 09/10] net: " Jason Baron
2012-02-21 20:03 ` [PATCH 10/10] jump label: Add docs better explaining the whole jump label mechanism Jason Baron
2012-02-29 10:15   ` [tip:perf/core] static keys: Add docs better explaining the whole 'struct static_key' mechanism tip-bot for Jason Baron
2012-02-21 20:09 ` [PATCH 00/10] jump label: introduce very_[un]likely + cleanups + docs H. Peter Anvin
2012-02-21 20:20   ` Jason Baron
2012-02-21 20:39     ` Steven Rostedt
2012-02-21 21:10       ` H. Peter Anvin
2012-02-21 21:16         ` Mathieu Desnoyers
2012-02-21 21:11       ` Mathieu Desnoyers
2012-02-22  7:32       ` Ingo Molnar
2012-02-22  7:53         ` Ingo Molnar
2012-02-22  8:01           ` H. Peter Anvin
2012-02-22  8:18             ` Ingo Molnar
2012-02-22  8:58               ` [PATCH] static keys: Introduce 'struct static_key', very_[un]likely(), static_key_slow_[inc|dec]() Ingo Molnar
2012-02-29 10:16                 ` [tip:perf/core] static keys: Introduce 'struct static_key', static_key_true()/false() and static_key_slow_[inc|dec]() tip-bot for Ingo Molnar
2012-02-22  9:03               ` [PATCH] jump labels: Explain the .config option better Ingo Molnar
2012-02-22 15:08               ` [PATCH 00/10] jump label: introduce very_[un]likely + cleanups + docs H. Peter Anvin
2012-02-22 15:51                 ` Ingo Molnar
2012-02-22 21:33               ` Paul Mackerras
2012-02-23 10:02                 ` Ingo Molnar
2012-02-23 16:21                   ` Jason Baron
2012-02-23 17:10                     ` H. Peter Anvin
2012-02-24  9:11                     ` Ingo Molnar
2012-02-23 17:18                   ` Linus Torvalds
2012-02-23 22:33                     ` Ingo Molnar
2012-02-23 22:39                       ` Ingo Molnar
2012-02-23 22:44                         ` Steven Rostedt
2012-02-23 23:18                         ` Mathieu Desnoyers
2012-02-24  2:25                           ` Jason Baron
2012-02-24  9:08                             ` Ingo Molnar
2012-02-24 15:35                               ` Jason Baron
2012-02-27  7:40                                 ` Ingo Molnar
2012-02-24 15:51                               ` Mathieu Desnoyers
2012-02-24 16:06                               ` Steven Rostedt
2012-02-24  7:52                         ` static keys: Introduce 'struct static_key', static_key_true()/false() and static_key_slow_[inc|dec]() Ingo Molnar
2012-02-24  7:59                           ` [PATCH] " Ingo Molnar
2012-02-24  7:54                         ` [PATCH] static keys: Add docs better explaining the whole 'struct static_key' mechanism Ingo Molnar
2012-02-23 22:45                       ` [PATCH 00/10] jump label: introduce very_[un]likely + cleanups + docs Linus Torvalds
2012-02-24  8:04                         ` Ingo Molnar
2012-02-24  2:42                       ` Jason Baron
2012-02-21 20:21   ` Steven Rostedt
2012-02-21 21:11     ` H. Peter Anvin
2012-02-22  6:50   ` Ingo Molnar
2012-02-22  7:03     ` H. Peter Anvin
2012-02-22  7:25       ` Ingo Molnar
2012-02-22  7:35         ` H. Peter Anvin
2012-02-22  7:48           ` Ingo Molnar
2012-02-22  7:55             ` H. Peter Anvin
2012-02-22  8:06               ` Ingo Molnar
2012-02-22 13:22                 ` Steven Rostedt
2012-02-22 13:34                   ` Ingo Molnar
2012-02-22 13:54                     ` Steven Rostedt
2012-02-22 14:20                       ` Mathieu Desnoyers
2012-02-22 14:36                         ` Steven Rostedt
2012-02-22 14:56                       ` Ingo Molnar
2012-02-22 15:11                         ` H. Peter Anvin
2012-02-22 15:11                         ` Peter Zijlstra
2012-02-22 15:47                           ` Ingo Molnar
2012-02-22 15:12                         ` Steven Rostedt
2012-02-22 15:15                           ` H. Peter Anvin
2012-02-22 15:19                           ` H. Peter Anvin
2012-02-22 15:42                           ` Jason Baron [this message]
2012-02-22 15:54                             ` Steven Rostedt
2012-02-22 15:56                               ` Jason Baron
2012-02-22 16:08                                 ` Steven Rostedt
2012-02-22 15:19                         ` Jason Baron
2012-02-22 15:40                           ` H. Peter Anvin
2012-02-22 15:13                       ` Peter Zijlstra
2012-02-22 15:32                         ` Peter Zijlstra
2012-02-22 17:14                           ` Richard Henderson
2012-02-22 18:28                             ` H. Peter Anvin
2012-02-22 18:58                             ` Jason Baron
2012-02-22 19:10                               ` H. Peter Anvin

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=20120222154206.GA3405@redhat.com \
    --to=jbaron@redhat.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=akpm@linux-foundation.org \
    --cc=davem@davemloft.net \
    --cc=ddaney.cavm@gmail.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=mingo@elte.hu \
    --cc=rostedt@goodmis.org \
    --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;
as well as URLs for NNTP newsgroup(s).