Re: [Patch 1/2] tracepoints for softirq entry/exit - add softirq-to-name array

Jason Baron
2009-03-16T19:00:45Z

hi,

I've update both patches to incorporate changes that were suggested -
I've shortened the softirq string name and made it 'const'. Below is a
re-spun patch 1/2.

thanks,

-Jason

Signed-off-by: Jason Baron <jbaron@redhat.com>

---

include/linux/interrupt.h | 6 ++++++
kernel/softirq.c | 8 +++++++-
2 files changed, 13 insertions(+), 1 deletions(-)

diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h
index e7bcfd7..dd3ff3f 100644
--- a/include/linux/interrupt.h
+++ b/include/linux/interrupt.h
@@ -258,6 +258,12 @@ enum
NR_SOFTIRQS
};

+/* map softirq index to softirq name. update 'softirq_to_name' in
+ * kernel/softirq.c when adding a new softirq.
+ */
+#define MAX_SOFTIRQ_NAME_LEN 10
+extern const char softirq_to_name[NR_SOFTIRQS][MAX_SOFTIRQ_NAME_LEN];
+
/* softirq mask and active fields moved to irq_cpustat_t in
* asm/hardirq.h to get better cache usage. KAO
*/
diff --git a/kernel/softirq.c b/kernel/softirq.c
index 40ff3cf..8f3ae57 100644
--- a/kernel/softirq.c
+++ b/kernel/softirq.c
@@ -53,6 +53,11 @@ static struct softirq_action softirq_vec[NR_SOFTIRQS] __cacheline_aligned_in_smp

static DEFINE_PER_CPU(struct task_struct *, ksoftirqd);

+const char softirq_to_name[NR_SOFTIRQS][MAX_SOFTIRQ_NAME_LEN] = {
+ "HI", "TIMER", "NET_TX", "NET_RX", "BLOCK", "TASKLET", "SCHED",
+ "HRTIMER", "RCU"
+};
+
/*
* we cannot loop indefinitely here to avoid userspace starvation,
* but we also don't want to introduce a worst case 1/HZ latency
@@ -209,9 +214,10 @@ restart: