aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/kernel.h
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2009-03-09 05:11:36 -0400
committerIngo Molnar <mingo@elte.hu>2009-03-09 05:11:36 -0400
commit7bffc23e56e92c14b787bf4d95249a32085bfed5 (patch)
tree9c1bbea2f258c82b5a9ff5e30db3a8f0c9cc3faa /include/linux/kernel.h
parent8a20d84d09ab5d121f989cd99e4fc5f4b49f98ba (diff)
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>
Diffstat (limited to 'include/linux/kernel.h')
-rw-r--r--include/linux/kernel.h10
1 files changed, 8 insertions, 2 deletions
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 4e726b9a71ec..7742798c9208 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -454,7 +454,10 @@ do { \
454do { \ 454do { \
455 static const char *trace_printk_fmt \ 455 static const char *trace_printk_fmt \
456 __attribute__((section("__trace_printk_fmt"))); \ 456 __attribute__((section("__trace_printk_fmt"))); \
457 trace_printk_fmt = fmt; \ 457 \
458 if (!trace_printk_fmt) \
459 trace_printk_fmt = fmt; \
460 \
458 __trace_printk_check_format(fmt, ##args); \ 461 __trace_printk_check_format(fmt, ##args); \
459 __trace_printk(_THIS_IP_, trace_printk_fmt, ##args); \ 462 __trace_printk(_THIS_IP_, trace_printk_fmt, ##args); \
460} while (0) 463} while (0)
@@ -467,7 +470,10 @@ __trace_printk(unsigned long ip, const char *fmt, ...)
467do { \ 470do { \
468 static const char *trace_printk_fmt \ 471 static const char *trace_printk_fmt \
469 __attribute__((section("__trace_printk_fmt"))); \ 472 __attribute__((section("__trace_printk_fmt"))); \
470 trace_printk_fmt = fmt; \ 473 \
474 if (!trace_printk_fmt) \
475 trace_printk_fmt = fmt; \
476 \
471 __ftrace_vprintk(_THIS_IP_, trace_printk_fmt, vargs); \ 477 __ftrace_vprintk(_THIS_IP_, trace_printk_fmt, vargs); \
472} while (0) 478} while (0)
473 479