public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Frederic Weisbecker <fweisbec@gmail.com>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: mingo@redhat.com, hpa@zytor.com, linux-kernel@vger.kernel.org,
	peterz@infradead.org, tglx@linutronix.de, mingo@elte.hu,
	linux-tip-commits@vger.kernel.org
Subject: Re: [tip:tracing/printk] tracing: optimize trace_printk()
Date: Mon, 9 Mar 2009 18:38:28 +0100	[thread overview]
Message-ID: <20090309173827.GA4913@nowhere> (raw)
In-Reply-To: <alpine.DEB.2.00.0903091324020.2203@gandalf.stny.rr.com>

On Mon, Mar 09, 2009 at 01:24:50PM -0400, Steven Rostedt wrote:
> 
> 
> 
> On Mon, 9 Mar 2009, Steven Rostedt wrote:
> 
> > 
> > On Mon, 9 Mar 2009, Ingo Molnar wrote:
> > > 
> > > tracing: optimize trace_printk()
> > > 
> > > Impact: micro-optimization
> > > 
> > > trace_printk() does this unconditionally:
> > > 
> > > 	trace_printk_fmt = fmt;
> > > 
> > > Where trace_printk_fmt is an entry into a global array. This is
> > > very SMP-unfriendly.
> > > 
> > > So only write it once per bootup.
> > > 
> > > Cc: Frederic Weisbecker <fweisbec@gmail.com>
> > > Cc: Steven Rostedt <rostedt@goodmis.org>
> > > Cc: Peter Zijlstra <peterz@infradead.org>
> > > LKML-Reference: <1236356510-8381-5-git-send-email-fweisbec@gmail.com>
> > > Signed-off-by: Ingo Molnar <mingo@elte.hu>
> > > 
> > > 
> > > ---
> > >  include/linux/kernel.h |   10 ++++++++--
> > >  1 files changed, 8 insertions(+), 2 deletions(-)
> > > 
> > > diff --git a/include/linux/kernel.h b/include/linux/kernel.h
> > > index 4e726b9..7742798 100644
> > > --- a/include/linux/kernel.h
> > > +++ b/include/linux/kernel.h
> > > @@ -454,7 +454,10 @@ do {									\
> > >  do {									\
> > >  	static const char *trace_printk_fmt				\
> > >  	__attribute__((section("__trace_printk_fmt")));			\
> 
> A I missed the semicolon. I wonder if we could make it a static init?
> 
> -- Steve


Actually I first tried to make it like this:
static const char *trace_printk_fmt 
___attribute__((section("__trace_printk_fmt"))) = fmt;

But gcc slapped me. That's why I moved it in the following line.



 
> > > -	trace_printk_fmt = fmt;					\
> > > +									\
> > > +	if (!trace_printk_fmt)						\
> > > +		trace_printk_fmt = fmt;					\
> > > +									\
> > 
> > But this is a static init. That is, it is done at initialization and not
> > every time.
> > 
> > The change actually slows down the system.
> > 
> > >  	__trace_printk_check_format(fmt, ##args);			\
> > >  	__trace_printk(_THIS_IP_, trace_printk_fmt, ##args);		\
> > >  } while (0)
> > > @@ -467,7 +470,10 @@ __trace_printk(unsigned long ip, const char *fmt, ...)
> > >  do {									\
> > >  	static const char *trace_printk_fmt				\
> > >  	__attribute__((section("__trace_printk_fmt")));			\
> > > -	trace_printk_fmt = fmt;					\
> > > +									\
> > > +	if (!trace_printk_fmt)						\
> > > +		trace_printk_fmt = fmt;					\
> > > +									\
> > 
> > Same here.
> > 
> > -- Steve
> > 
> > >  	__ftrace_vprintk(_THIS_IP_, trace_printk_fmt, vargs);		\
> > >  } while (0)
> > >  
> > > 
> > 


  reply	other threads:[~2009-03-09 17:38 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-06 16:21 [PATCH 0/5 v3] Binary ftrace_printk Frederic Weisbecker
2009-03-06 16:21 ` [PATCH 1/5 v2] add binary printf Frederic Weisbecker
2009-03-06 16:50   ` Steven Rostedt
2009-03-06 17:00   ` [tip:core/printk] vsprintf: " Lai Jiangshan
2009-03-06 16:21 ` [PATCH 2/5 v3] ftrace: infrastructure for supporting binary record Frederic Weisbecker
2009-03-06 17:00   ` [tip:tracing/printk] tracing: " Lai Jiangshan
2009-03-06 16:21 ` [PATCH 3/5 v3] ftrace: add ftrace_bprintk() Frederic Weisbecker
2009-03-06 17:00   ` [tip:tracing/printk] tracing: add trace_bprintk() Lai Jiangshan
2009-03-06 16:21 ` [PATCH 4/5 v3] tracing/core: drop the old ftrace_printk implementation in favour of ftrace_bprintk Frederic Weisbecker
2009-03-06 16:49   ` Steven Rostedt
2009-03-06 17:02     ` Ingo Molnar
2009-03-06 17:14       ` Ingo Molnar
2009-03-06 18:04         ` Steven Rostedt
2009-03-06 18:49           ` Ingo Molnar
2009-03-06 19:09             ` Frederic Weisbecker
2009-03-06 19:17             ` Ingo Molnar
2009-03-06 17:14     ` Frederic Weisbecker
2009-03-06 17:01   ` [tip:tracing/printk] tracing/core: drop the old trace_printk() implementation in favour of trace_bprintk() Frederic Weisbecker
2009-03-06 17:01   ` [tip:tracing/printk] tracing: trace_bprintk() cleanups Ingo Molnar
2009-03-09  9:12   ` [tip:tracing/printk] tracing: trace_printk() fix, move format array to data section Ingo Molnar
2009-03-09  9:12   ` [tip:tracing/printk] tracing: optimize trace_printk() Ingo Molnar
2009-03-09 17:23     ` Steven Rostedt
2009-03-09 17:24       ` Steven Rostedt
2009-03-09 17:38         ` Frederic Weisbecker [this message]
2009-03-06 16:21 ` [PATCH 5/5 v3] vsprintf: unify the format decoding layer for its 3 users Frederic Weisbecker
2009-03-06 17:00   ` [tip:core/printk] " Frederic Weisbecker

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=20090309173827.GA4913@nowhere \
    --to=fweisbec@gmail.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox