[PATCH v2 4/6] trace: Add tracepoints to reschedule interrupt handler

From: Vaibhav Nagarnaik
Date: Wed Jul 27 2011 - 14:58:17 EST


This is a part of overall effort to trace all the interrupts happening
in a system. This shows how the interrupts are interacting with other
events and what time is spent in kernel space versus user space.

Signed-off-by: Vaibhav Nagarnaik <vnagarnaik@xxxxxxxxxx>
---
include/trace/events/irq.h | 45 ++++++++++++++++++++++++++++++++++++++++++++
kernel/sched.c | 3 ++
2 files changed, 48 insertions(+), 0 deletions(-)

diff --git a/include/trace/events/irq.h b/include/trace/events/irq.h
index d8fab89..a2a0a49 100644
--- a/include/trace/events/irq.h
+++ b/include/trace/events/irq.h
@@ -339,6 +339,51 @@ DEFINE_EVENT(irq_work, irq_work_run_exit,
TP_ARGS(ignore)
);

+DECLARE_EVENT_CLASS(reschedule_interrupt,
+
+ TP_PROTO(unsigned int ignore),
+
+ TP_ARGS(ignore),
+
+ TP_STRUCT__entry(
+ __field( unsigned int, ignore )
+ ),
+
+ TP_fast_assign(
+ __entry->ignore = ignore;
+ ),
+
+ TP_printk("%u", __entry->ignore)
+);
+
+/**
+ * reschedule_interrupt_entry - called immediately after entering the
+ * reschedule interrupt handler
+ *
+ * When used in combination with the reschedule_interrupt_exit tracepoint
+ * we can determine the reschedule interrupt handler runtime.
+ */
+DEFINE_EVENT(reschedule_interrupt, reschedule_interrupt_entry,
+
+ TP_PROTO(unsigned int ignore),
+
+ TP_ARGS(ignore)
+);
+
+/**
+ * reschedule_interrupt_exit - called just before the reschedule interrupt
+ * handler returns
+ *
+ * When used in combination with the reschedule_interrupt_entry tracepoint
+ * we can determine the reschedule interrupt handler runtime.
+ */
+DEFINE_EVENT(reschedule_interrupt, reschedule_interrupt_exit,
+
+ TP_PROTO(unsigned int ignore),
+
+ TP_ARGS(ignore)
+);
+
#endif /* _TRACE_IRQ_H */

/* This part must be outside protection */
diff --git a/kernel/sched.c b/kernel/sched.c
index ccacdbd..f48b5aa 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -82,6 +82,7 @@
#include "sched_cpupri.h"
#include "workqueue_sched.h"
#include "sched_autogroup.h"
+#include <trace/events/irq.h>

#define CREATE_TRACE_POINTS
#include <trace/events/sched.h>
@@ -2578,6 +2579,7 @@ static void sched_ttwu_pending(void)
struct rq *rq = this_rq();
struct task_struct *list = xchg(&rq->wake_list, NULL);

+ trace_reschedule_interrupt_entry(0);
if (!list)
return;

@@ -2610,6 +2612,7 @@ void scheduler_ipi(void)
irq_enter();
sched_ttwu_do_pending(list);
irq_exit();
+ trace_reschedule_interrupt_exit(0);
}

static void ttwu_queue_remote(struct task_struct *p, int cpu)
--
1.7.3.1

--
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/