All of lore.kernel.org
 help / color / mirror / Atom feed
From: Teng Qin <qinteng@fb.com>
To: <peterz@infradead.org>
Cc: <mingo@redhat.com>, <ast@fb.com>, <bgregg@netflix.com>,
	<daniel@iogearbox.net>, <yhs@fb.com>,
	<linux-kernel@vger.kernel.org>, <Kernel-team@fb.com>,
	Teng Qin <qinteng@fb.com>
Subject: [PATCH tip 1/3] Improve sched_switch Tracepoint
Date: Thu, 14 Dec 2017 12:20:42 -0800	[thread overview]
Message-ID: <20171214202044.1629279-2-qinteng@fb.com> (raw)
In-Reply-To: <20171214202044.1629279-1-qinteng@fb.com>

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@fb.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

  reply	other threads:[~2017-12-14 20:20 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-14 20:20 [PATCH tip 0/3] Improvements of scheduler related Tracepoints Teng Qin
2017-12-14 20:20 ` Teng Qin [this message]
2017-12-14 20:20 ` [PATCH tip 2/3] Improve sched_process_fork Tracepoint Teng Qin
2017-12-14 20:20 ` [PATCH tip 3/3] Improve sched_process_exit Tracepoint Teng Qin
2017-12-14 20:49 ` [PATCH tip 0/3] Improvements of scheduler related Tracepoints Peter Zijlstra
2017-12-15  3:16   ` Alexei Starovoitov
2017-12-15  7:39     ` Peter Zijlstra
2017-12-15  8:53       ` Teng Qin
2017-12-15  9:53         ` Peter Zijlstra
2017-12-15 17:09       ` Alexei Starovoitov
2017-12-18  9:11         ` Peter Zijlstra
2017-12-21  2:03           ` tracepoint_probe_register and bpf. Was: " Alexei Starovoitov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171214202044.1629279-2-qinteng@fb.com \
    --to=qinteng@fb.com \
    --cc=Kernel-team@fb.com \
    --cc=ast@fb.com \
    --cc=bgregg@netflix.com \
    --cc=daniel@iogearbox.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=yhs@fb.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.