From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752150Ab1AERlt (ORCPT ); Wed, 5 Jan 2011 12:41:49 -0500 Received: from hrndva-omtalb.mail.rr.com ([71.74.56.125]:40305 "EHLO hrndva-omtalb.mail.rr.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751257Ab1AERls (ORCPT ); Wed, 5 Jan 2011 12:41:48 -0500 X-Authority-Analysis: v=1.1 cv=UQuFHoD2CPQ248x8AXEbKhr4z9AaDqApxmEl3BhfZ64= c=1 sm=0 a=mIBq1ZzCEX8A:10 a=Q9fys5e9bTEA:10 a=OPBmh+XkhLl+Enan7BmTLg==:17 a=5ffcoPQF9ca5kxUd9ncA:9 a=IEVzKfwMUwHIQPae49sA:7 a=srgZQdj9x2wLsUAOWPD6dBtiTGoA:4 a=PUjeQqilurYA:10 a=OPBmh+XkhLl+Enan7BmTLg==:117 X-Cloudmark-Score: 0 X-Originating-IP: 67.242.120.143 Subject: Re: [PATCH 2/2] jump label: introduce static_branch() From: Steven Rostedt To: Jason Baron Cc: peterz@infradead.org, mathieu.desnoyers@polymtl.ca, hpa@zytor.com, 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, ddaney@caviumnetworks.com, michael@ellerman.id.au, linux-kernel@vger.kernel.org In-Reply-To: <2d8c38bd7ca93e162aedb8e7acfc8bdb96d85de2.1294239591.git.jbaron@redhat.com> References: <2d8c38bd7ca93e162aedb8e7acfc8bdb96d85de2.1294239591.git.jbaron@redhat.com> Content-Type: text/plain; charset="ISO-8859-15" Date: Wed, 05 Jan 2011 12:41:46 -0500 Message-ID: <1294249306.26623.33.camel@gandalf.stny.rr.com> Mime-Version: 1.0 X-Mailer: Evolution 2.30.3 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 2011-01-05 at 10:43 -0500, 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)); \ BTW, do not put real diffs in the change log. That is, remove the header from it. This can confuse tools that pull in patches from mailing lists. As this change will be done in the code itself. Thanks, -- Steve > > > 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':