[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20171214202044.1629279-2-qinteng@fb.com>
Date: Thu, 14 Dec 2017 12:20:42 -0800
From: Teng Qin <qinteng@...com>
To: <peterz@...radead.org>
CC: <mingo@...hat.com>, <ast@...com>, <bgregg@...flix.com>,
<daniel@...earbox.net>, <yhs@...com>,
<linux-kernel@...r.kernel.org>, <Kernel-team@...com>,
Teng Qin <qinteng@...com>
Subject: [PATCH tip 1/3] Improve sched_switch Tracepoint
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@...com>
---
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
Powered by blists - more mailing lists