lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Mon, 9 Mar 2009 18:38:28 +0100
From:	Frederic Weisbecker <fweisbec@...il.com>
To:	Steven Rostedt <rostedt@...dmis.org>
Cc:	mingo@...hat.com, hpa@...or.com, linux-kernel@...r.kernel.org,
	peterz@...radead.org, tglx@...utronix.de, mingo@...e.hu,
	linux-tip-commits@...r.kernel.org
Subject: Re: [tip:tracing/printk] tracing: optimize trace_printk()

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@...il.com>
> > > Cc: Steven Rostedt <rostedt@...dmis.org>
> > > Cc: Peter Zijlstra <peterz@...radead.org>
> > > LKML-Reference: <1236356510-8381-5-git-send-email-fweisbec@...il.com>
> > > Signed-off-by: Ingo Molnar <mingo@...e.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)
> > >  
> > > 
> > 

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ