All of lore.kernel.org
 help / color / mirror / Atom feed
From: Li Zefan <lizf@cn.fujitsu.com>
To: Steven Rostedt <rostedt@goodmis.org>,
	Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>, LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH] tracing/irq: use softirq_to_name instead of __print_symbolic
Date: Mon, 01 Jun 2009 16:52:23 +0800	[thread overview]
Message-ID: <4A2396C7.3000700@cn.fujitsu.com> (raw)

| commit c2adae0970ca1db8adb92fb56ae3bcabd916e8bd
| Author: Steven Rostedt <srostedt@redhat.com>
| Date:   Wed May 20 19:56:19 2009 -0400
|
|    tracing: convert irq events to use __print_symbolic
|
|    The recording of the names at trace time is inefficient. This patch
|    implements the softirq event recording to only record the vector
|    and then use the __print_symbolic interface to print out the names.
|
|    [ Impact: faster recording of softirq events ]

It's great to boost recording of softirq events, but why not simply
use softirq_to_name in TP_printk()?

The above commit has 2 flaws:

  - we waste memory defining local static struct trace_print_flags array
    in each softirq TRACE_EVENT
  - if someone adds/removes a softirq, he may not know show_softirq_name()
    needs to be updated

Another issue with the above commit, that the output of softirq events
becomes:

  X-1701  [000]  1595.220739: softirq_entry: softirq=1 action=TIMER_SOFTIRQ

Compared to the original output:

  X-1701  [000]  1595.220739: softirq_entry: softirq=1 action=TIMER

[ Impact: reserve the original output format of softirq events ]

Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
---
 include/trace/events/irq.h |   17 ++---------------
 1 files changed, 2 insertions(+), 15 deletions(-)

diff --git a/include/trace/events/irq.h b/include/trace/events/irq.h
index 683fb36..2ff9998 100644
--- a/include/trace/events/irq.h
+++ b/include/trace/events/irq.h
@@ -7,19 +7,6 @@
 #undef TRACE_SYSTEM
 #define TRACE_SYSTEM irq
 
-#define softirq_name(sirq) { sirq, #sirq }
-#define show_softirq_name(val)						\
-	__print_symbolic(val,						\
-			 softirq_name(HI_SOFTIRQ),			\
-			 softirq_name(TIMER_SOFTIRQ),			\
-			 softirq_name(NET_TX_SOFTIRQ),			\
-			 softirq_name(NET_RX_SOFTIRQ),			\
-			 softirq_name(BLOCK_SOFTIRQ),			\
-			 softirq_name(TASKLET_SOFTIRQ),			\
-			 softirq_name(SCHED_SOFTIRQ),			\
-			 softirq_name(HRTIMER_SOFTIRQ),			\
-			 softirq_name(RCU_SOFTIRQ))
-
 /**
  * irq_handler_entry - called immediately before the irq action handler
  * @irq: irq number
@@ -107,7 +94,7 @@ TRACE_EVENT(softirq_entry,
 	),
 
 	TP_printk("softirq=%d action=%s", __entry->vec,
-		  show_softirq_name(__entry->vec))
+		  softirq_to_name[__entry->vec])
 );
 
 /**
@@ -136,7 +123,7 @@ TRACE_EVENT(softirq_exit,
 	),
 
 	TP_printk("softirq=%d action=%s", __entry->vec,
-		  show_softirq_name(__entry->vec))
+		  softirq_to_name[__entry->vec])
 );
 
 #endif /*  _TRACE_IRQ_H */
-- 
1.5.4.rc3


             reply	other threads:[~2009-06-01  8:51 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-01  8:52 Li Zefan [this message]
2009-06-01 14:36 ` [PATCH] tracing/irq: use softirq_to_name instead of __print_symbolic Christoph Hellwig
2009-06-01 15:06   ` Steven Rostedt
2009-06-02  1:31     ` Li Zefan

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=4A2396C7.3000700@cn.fujitsu.com \
    --to=lizf@cn.fujitsu.com \
    --cc=fweisbec@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=rostedt@goodmis.org \
    /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.