[PATCH tip 1/3] Improve sched_switch Tracepoint
From: Teng Qin
Date: Thu Dec 14 2017 - 15:21:02 EST
This commit adds value of the preempt flag to sched_switch's Tracepoint
struct. The value of the flag is already passed into the Tracepoint as
argument but currently only used to compute previous task's state.
Exposing the value is useful during debugging of contention issues.
This commit also exposes pointers of the previous and next task_struct in
the Tracepoint's struct. BPF programs can read task information via task
struct pointer. Exposing these pointers explicitly gives BPF programs an
easy and reliable way of using the Tracepoint.
Signed-off-by: Teng Qin <qinteng@xxxxxx>
---
include/trace/events/sched.h | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/include/trace/events/sched.h b/include/trace/events/sched.h
index bc01e06..9297b33 100644
--- a/include/trace/events/sched.h
+++ b/include/trace/events/sched.h
@@ -141,6 +141,9 @@ TRACE_EVENT(sched_switch,
__array( char, next_comm, TASK_COMM_LEN )
__field( pid_t, next_pid )
__field( int, next_prio )
+ __field( bool, preempt )
+ __field( void *, prev_task )
+ __field( void *, next_task )
),
TP_fast_assign(
@@ -151,6 +154,9 @@ TRACE_EVENT(sched_switch,
memcpy(__entry->prev_comm, prev->comm, TASK_COMM_LEN);
__entry->next_pid = next->pid;
__entry->next_prio = next->prio;
+ __entry->preempt = preempt;
+ __entry->prev_task = (void *)prev;
+ __entry->next_task = (void *)next;
/* XXX SCHED_DEADLINE */
),
--
2.9.5