Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752932AbdLNUU7 (ORCPT ); Thu, 14 Dec 2017 15:20:59 -0500 Received: from mx0b-00082601.pphosted.com ([67.231.153.30]:57120 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752748AbdLNUUy (ORCPT ); Thu, 14 Dec 2017 15:20:54 -0500 Smtp-Origin-Hostprefix: devbig From: Teng Qin Smtp-Origin-Hostname: devbig473.prn1.facebook.com To: CC: , , , , , , , Teng Qin Smtp-Origin-Cluster: prn1c29 Subject: [PATCH tip 1/3] Improve sched_switch Tracepoint Date: Thu, 14 Dec 2017 12:20:42 -0800 Message-ID: <20171214202044.1629279-2-qinteng@fb.com> X-Mailer: git-send-email 2.9.5 In-Reply-To: <20171214202044.1629279-1-qinteng@fb.com> References: <20171214202044.1629279-1-qinteng@fb.com> X-FB-Internal: Safe MIME-Version: 1.0 Content-Type: text/plain X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-12-14_12:,, signatures=0 X-Proofpoint-Spam-Reason: safe X-FB-Internal: Safe Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1444 Lines: 41 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 --- 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