[PATCH] tracing/irq: use softirq_to_name instead of __print_symbolic

From: Li Zefan
Date: Mon Jun 01 2009 - 04:51:22 EST


| commit c2adae0970ca1db8adb92fb56ae3bcabd916e8bd
| Author: Steven Rostedt <srostedt@xxxxxxxxxx>
| 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@xxxxxxxxxxxxxx>
---
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

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