All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Daney <ddaney@caviumnetworks.com>
To: Jason Baron <jbaron@redhat.com>, Ralf Baechle <ralf@linux-mips.org>
Cc: peterz@infradead.org, mathieu.desnoyers@polymtl.ca,
	hpa@zytor.com, rostedt@goodmis.org, mingo@elte.hu,
	tglx@linutronix.de, andi@firstfloor.org, roland@redhat.com,
	rth@redhat.com, masami.hiramatsu.pt@hitachi.com,
	fweisbec@gmail.com, avi@redhat.com, davem@davemloft.net,
	sam@ravnborg.org, michael@ellerman.id.au,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] jump label: introduce static_branch()
Date: Wed, 05 Jan 2011 09:32:11 -0800	[thread overview]
Message-ID: <4D24AB1B.2010209@caviumnetworks.com> (raw)
In-Reply-To: <2d8c38bd7ca93e162aedb8e7acfc8bdb96d85de2.1294239591.git.jbaron@redhat.com>

On 01/05/2011 07:43 AM, Jason Baron wrote:
> Introduce:
>
> static __always_inline bool static_branch(struct jump_label_key *key)
>
> to replace the old JUMP_LABEL(key, label) macro.
>
> The new static_branch(), simplifies the usage of jump labels. Since,
> static_branch() returns a boolean, it can be used as part of an if()
> construct. It also, allows us to drop the 'label' argument from the
> prototype. Its probably best understood with an example, here is the part
> of the patch that converts the tracepoints to use unlikely_switch():
>
> --- a/include/linux/tracepoint.h
> +++ b/include/linux/tracepoint.h
> @@ -146,9 +146,7 @@ static inline void tracepoint_update_probe_range(struct tracepoint *begin,
>   	extern struct tracepoint __tracepoint_##name;			\
>   	static inline void trace_##name(proto)				\
>   	{								\
> -		JUMP_LABEL(&__tracepoint_##name.key, do_trace);		\
> -		return;							\
> -do_trace:								\
> +		if (static_branch(&__tracepoint_##name.key))		\
>   			__DO_TRACE(&__tracepoint_##name,		\
>   				TP_PROTO(data_proto),			\
>   				TP_ARGS(data_args));			\
>
>
> I analyzed the code produced by static_branch(), and it seems to be
> at least as good as the code generated by the JUMP_LABEL(). As a reminder,
> we get a single nop in the fastpath for -02. But will often times get
> a 'double jmp' in the -Os case. That is, 'jmp 0', followed by a jmp around
> the disabled code. We believe that future gcc tweaks to allow block
> re-ordering in the -Os, will solve the -Os case in the future.
>
> I also saw a 1-2% tbench throughput improvement when compiling with
> jump labels.
>
> This patch also addresses a build issue that Tetsuo Handa reported where
> gcc v3.3 currently chokes on compiling 'dynamic debug':
>
> include/net/inet_connection_sock.h: In function `inet_csk_reset_xmit_timer':
> include/net/inet_connection_sock.h:236: error: duplicate label declaration `do_printk'
> include/net/inet_connection_sock.h:219: error: this is a previous declaration
> include/net/inet_connection_sock.h:236: error: duplicate label declaration `out'
> include/net/inet_connection_sock.h:219: error: this is a previous declaration
> include/net/inet_connection_sock.h:236: error: duplicate label `do_printk'
> include/net/inet_connection_sock.h:236: error: duplicate label `out'
>
>
> Thanks to H. Peter Anvin for suggesting this improved syntax.
>
> Suggested-by: H. Peter Anvin<hpa@linux.intel.com>
> Signed-off-by: Jason Baron<jbaron@redhat.com>
> Tested-by: Tetsuo Handa<penguin-kernel@i-love.sakura.ne.jp>
> ---
>   arch/sparc/include/asm/jump_label.h |   25 ++++++++++++++-----------
>   arch/x86/include/asm/jump_label.h   |   22 +++++++++++++---------
>   arch/x86/kernel/jump_label.c        |    2 +-
>   include/linux/dynamic_debug.h       |   18 ++++--------------
>   include/linux/jump_label.h          |   26 +++++++++++---------------
>   include/linux/jump_label_ref.h      |   18 +++++++++++-------
>   include/linux/perf_event.h          |   26 +++++++++++++-------------
>   include/linux/tracepoint.h          |    4 +---
>   kernel/jump_label.c                 |    2 +-
>   9 files changed, 69 insertions(+), 74 deletions(-)
>
[...]

This patch will conflict with the MIPS jump label support that Ralf has 
queued up for 2.6.38.

David Daney

  parent reply	other threads:[~2011-01-05 17:32 UTC|newest]

Thread overview: 113+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-05 15:43 [PATCH 0/2] jump label: 2.6.38 updates Jason Baron
2011-01-05 15:43 ` [PATCH 1/2] jump label: make enable/disable o(1) Jason Baron
2011-01-05 17:31   ` Steven Rostedt
2011-01-05 21:19     ` Jason Baron
2011-01-05 15:43 ` [PATCH 2/2] jump label: introduce static_branch() Jason Baron
2011-01-05 17:15   ` Frederic Weisbecker
2011-01-05 17:46     ` Steven Rostedt
2011-01-05 18:52       ` H. Peter Anvin
2011-01-05 21:19         ` Jason Baron
2011-01-05 21:14     ` Jason Baron
2011-01-05 17:32   ` David Daney [this message]
2011-01-05 17:43     ` Steven Rostedt
2011-01-05 18:44       ` David Miller
2011-01-05 20:04         ` Steven Rostedt
2011-01-05 18:56       ` H. Peter Anvin
2011-01-05 19:14         ` Ingo Molnar
2011-01-05 19:32           ` David Daney
2011-01-05 19:50             ` Ingo Molnar
2011-01-05 20:07               ` David Daney
2011-01-05 20:08                 ` H. Peter Anvin
2011-01-05 20:18                 ` Ingo Molnar
2011-01-05 21:16     ` Jason Baron
2011-01-05 17:41   ` Steven Rostedt
2011-01-09 18:48   ` Mathieu Desnoyers
2011-02-11 19:25 ` [PATCH 0/2] jump label: 2.6.38 updates Peter Zijlstra
2011-02-11 21:13   ` Mathieu Desnoyers
     [not found]   ` <BLU0-SMTP101B686C32E10BA346B15F896EF0@phx.gbl>
2011-02-11 21:38     ` Peter Zijlstra
2011-02-11 22:15       ` Jason Baron
2011-02-11 22:19         ` H. Peter Anvin
2011-02-11 22:30         ` Mathieu Desnoyers
2011-02-11 22:20       ` Mathieu Desnoyers
     [not found]       ` <BLU0-SMTP8562BA758CF8AAE5323AE296EF0@phx.gbl>
2011-02-11 22:27         ` Jason Baron
2011-02-11 22:32           ` Mathieu Desnoyers
2011-02-12 18:47       ` Peter Zijlstra
2011-02-14 12:27         ` Ingo Molnar
2011-02-14 15:51         ` Jason Baron
2011-02-14 15:57           ` Peter Zijlstra
2011-02-14 16:04             ` Jason Baron
2011-02-14 16:14               ` Mathieu Desnoyers
     [not found]               ` <BLU0-SMTP4069A1A89F06CDFF9B28F896D00@phx.gbl>
2011-02-14 16:25                 ` Peter Zijlstra
2011-02-14 16:29                   ` Jason Baron
2011-02-14 16:37                     ` Peter Zijlstra
2011-02-14 16:43                       ` Mathieu Desnoyers
2011-02-14 16:46                       ` Steven Rostedt
2011-02-14 16:53                         ` Peter Zijlstra
2011-02-14 17:18                         ` Steven Rostedt
2011-02-14 17:23                           ` Mike Frysinger
2011-02-14 17:27                           ` Peter Zijlstra
2011-02-14 17:29                             ` Mike Frysinger
2011-02-14 17:38                               ` Peter Zijlstra
2011-02-14 17:45                                 ` Mike Frysinger
2011-02-14 17:38                             ` Will Newton
2011-02-14 17:43                               ` Peter Zijlstra
2011-02-14 17:50                                 ` Will Newton
2011-02-14 18:04                                   ` Peter Zijlstra
2011-02-14 18:24                                   ` Peter Zijlstra
2011-02-14 18:53                                     ` Mathieu Desnoyers
2011-02-14 21:29                                     ` Steven Rostedt
2011-02-14 21:39                                       ` Steven Rostedt
2011-02-14 21:46                                         ` David Miller
2011-02-14 22:20                                           ` Steven Rostedt
2011-02-14 22:21                                             ` Steven Rostedt
2011-02-14 22:21                                             ` H. Peter Anvin
2011-02-14 22:29                                               ` Mathieu Desnoyers
     [not found]                                               ` <BLU0-SMTP98BFCC52FD41661DD9CC1E96D00@phx.gbl>
2011-02-14 22:33                                                 ` David Miller
2011-02-14 22:33                                             ` David Miller
2011-02-14 22:37                                           ` Matt Fleming
2011-02-14 23:03                                             ` Mathieu Desnoyers
     [not found]                                             ` <BLU0-SMTP166A8555C791786059B0FF96D00@phx.gbl>
2011-02-14 23:09                                               ` Paul E. McKenney
2011-02-14 23:29                                                 ` Mathieu Desnoyers
     [not found]                                                 ` <BLU0-SMTP4599FAAD7330498472B87396D00@phx.gbl>
2011-02-15  0:19                                                   ` Segher Boessenkool
2011-02-15  0:48                                                     ` Mathieu Desnoyers
2011-02-15  1:29                                                     ` Steven Rostedt
     [not found]                                                 ` <BLU0-SMTP984E876DBDFBC13F4C86F896D00@phx.gbl>
2011-02-15  0:42                                                   ` Paul E. McKenney
2011-02-15  0:51                                                     ` Mathieu Desnoyers
2011-02-15 11:53                                                 ` Will Newton
2011-02-18 19:03                                                   ` Paul E. McKenney
2011-02-14 23:19                                             ` H. Peter Anvin
2011-02-15 11:01                                               ` Will Newton
2011-02-15 13:31                                                 ` H. Peter Anvin
2011-02-15 13:49                                                   ` Steven Rostedt
2011-02-15 14:04                                                   ` Will Newton
2011-02-15 21:11                                                 ` Will Simoneau
2011-02-15 21:27                                                   ` David Miller
2011-02-15 21:56                                                     ` Will Simoneau
2011-02-16 10:15                                                       ` Will Newton
2011-02-16 12:18                                                         ` Steven Rostedt
2011-02-16 12:41                                                           ` Will Newton
2011-02-16 13:24                                                             ` Mathieu Desnoyers
2011-02-16 22:51                                                             ` Will Simoneau
2011-02-17  0:53                                                               ` Please watch your cc lists Andi Kleen
2011-02-17  0:56                                                                 ` David Miller
2011-02-17  1:04                                                                   ` Michael Witten
2011-02-17 10:55                                                               ` [PATCH 0/2] jump label: 2.6.38 updates Will Newton
     [not found]                                                             ` <BLU0-SMTP80F56386E7E060A3B2020B96D20@phx.gbl>
2011-02-17  1:55                                                               ` Masami Hiramatsu
2011-02-17  3:19                                                                 ` H. Peter Anvin
2011-02-17 16:03                                                                   ` Mathieu Desnoyers
     [not found]                                                             ` <BLU0-SMTP71BCB155CBAE79997EE08D96D20@phx.gbl>
2011-02-17  3:36                                                               ` Steven Rostedt
2011-02-17 16:13                                                                 ` Mathieu Desnoyers
     [not found]                                                                 ` <BLU0-SMTP51D40A5B1DACA8883D6AB596D50@phx.gbl>
2011-02-17 20:09                                                                   ` Steven Rostedt
2011-02-15 22:20                                                     ` Benjamin Herrenschmidt
2011-02-16  8:35                                                       ` Ingo Molnar
2011-02-17  1:04                                                         ` H. Peter Anvin
2011-02-17 12:51                                                           ` Ingo Molnar
     [not found]                                             ` <BLU0-SMTP637B2E9372CFBF3A0B5B0996D00@phx.gbl>
2011-02-14 23:25                                               ` David Miller
2011-02-14 23:34                                                 ` Mathieu Desnoyers
     [not found]                                                 ` <20110214233405.GC17432@Krystal>
2011-02-14 23:52                                                   ` Mathieu Desnoyers
2011-02-14 22:15                                         ` Matt Fleming
2011-02-15 15:20                             ` Heiko Carstens
     [not found]                       ` <BLU0-SMTP64371A838030ED92A7CCB696D00@phx.gbl>
2011-02-14 18:54                         ` Jason Baron
2011-02-14 19:20                           ` Peter Zijlstra
2011-02-14 19:48                             ` Mathieu Desnoyers
2011-02-14 16:11         ` Mathieu Desnoyers

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=4D24AB1B.2010209@caviumnetworks.com \
    --to=ddaney@caviumnetworks.com \
    --cc=andi@firstfloor.org \
    --cc=avi@redhat.com \
    --cc=davem@davemloft.net \
    --cc=fweisbec@gmail.com \
    --cc=hpa@zytor.com \
    --cc=jbaron@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=masami.hiramatsu.pt@hitachi.com \
    --cc=mathieu.desnoyers@polymtl.ca \
    --cc=michael@ellerman.id.au \
    --cc=mingo@elte.hu \
    --cc=peterz@infradead.org \
    --cc=ralf@linux-mips.org \
    --cc=roland@redhat.com \
    --cc=rostedt@goodmis.org \
    --cc=rth@redhat.com \
    --cc=sam@ravnborg.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.