From: Julien Desfossez <jdesfossez@efficios.com>
To: peterz@infradead.org, tglx@linutronix.de, rostedt@goodmis.org,
mingo@redhat.com, daolivei@redhat.com
Cc: mathieu.desnoyers@efficios.com, linux-kernel@vger.kernel.org,
Julien Desfossez <jdesfossez@efficios.com>
Subject: [RFC PATCH v2 4/5] tracing: extend sched_pi_setprio
Date: Fri, 23 Sep 2016 12:49:34 -0400 [thread overview]
Message-ID: <1474649375-28056-5-git-send-email-jdesfossez@efficios.com> (raw)
In-Reply-To: <1474649375-28056-1-git-send-email-jdesfossez@efficios.com>
Use the TRACE_EVENT_MAP macro to extend the sched_pi_setprio into
sched_pi_update_prio. The pre-existing event is untouched. This gets rid
of the old/new prio fields, and instead outputs the scheduling update
based on the top waiter of the rtmutex.
Boosting:
sched_pi_update_prio: comm=lowprio1, pid=3818, old_policy=SCHED_NORMAL,
old_nice=0, old_rt_priority=0, old_dl_runtime=0,
old_dl_deadline=0, old_dl_period=0, top_waiter_comm=highprio0,
top_waiter_pid=3820, new_policy=SCHED_FIFO, new_nice=0,
new_rt_priority=90, new_dl_runtime=0, new_dl_deadline=0,
new_dl_period=0
Unboosting:
sched_pi_update_prio: comm=lowprio1, pid=3818, old_policy=SCHED_FIFO,
old_nice=0, old_rt_priority=90, old_dl_runtime=0, old_dl_deadline=0,
old_dl_period=0, top_waiter_comm=, top_waiter_pid=-1,
new_policy=SCHED_NORMAL, new_nice=0, new_rt_priority=0,
new_dl_runtime=0, new_dl_deadline=0, new_dl_period=0
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Steven Rostedt (Red Hat) <rostedt@goodmis.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Reviewed-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
---
include/trace/events/sched.h | 96 ++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 96 insertions(+)
diff --git a/include/trace/events/sched.h b/include/trace/events/sched.h
index 6880682..582357d 100644
--- a/include/trace/events/sched.h
+++ b/include/trace/events/sched.h
@@ -658,6 +658,102 @@ static inline long __trace_sched_switch_state(bool preempt, struct task_struct *
__entry->oldprio, __entry->newprio)
);
+/*
+ * Extract the complete scheduling information from the before
+ * and after the change of priority.
+ */
+TRACE_EVENT_MAP(sched_pi_setprio, sched_pi_update_prio,
+
+ TP_PROTO(struct task_struct *tsk, int newprio),
+
+ TP_ARGS(tsk, newprio),
+
+ TP_STRUCT__entry(
+ __array( char, comm, TASK_COMM_LEN )
+ __field( pid_t, pid )
+ __field( unsigned int, old_policy )
+ __field( int, old_nice )
+ __field( unsigned int, old_rt_priority )
+ __field( u64, old_dl_runtime )
+ __field( u64, old_dl_deadline )
+ __field( u64, old_dl_period )
+ __array( char, top_waiter_comm, TASK_COMM_LEN )
+ __field( pid_t, top_waiter_pid )
+ __field( unsigned int, new_policy )
+ __field( int, new_nice )
+ __field( unsigned int, new_rt_priority )
+ __field( u64, new_dl_runtime )
+ __field( u64, new_dl_deadline )
+ __field( u64, new_dl_period )
+ ),
+
+ TP_fast_assign(
+ struct task_struct *top_waiter = rt_mutex_get_top_task(tsk);
+
+ memcpy(__entry->comm, tsk->comm, TASK_COMM_LEN);
+ __entry->pid = tsk->pid;
+ __entry->old_policy = effective_policy(
+ tsk->policy, tsk->prio);
+ __entry->old_nice = task_nice(tsk);
+ __entry->old_rt_priority = effective_rt_prio(
+ tsk->prio);
+ __entry->old_dl_runtime = dl_prio(tsk->prio) ?
+ tsk->dl.dl_runtime : 0;
+ __entry->old_dl_deadline = dl_prio(tsk->prio) ?
+ tsk->dl.dl_deadline : 0;
+ __entry->old_dl_period = dl_prio(tsk->prio) ?
+ tsk->dl.dl_period : 0;
+ if (top_waiter) {
+ memcpy(__entry->top_waiter_comm, top_waiter->comm, TASK_COMM_LEN);
+ __entry->top_waiter_pid = top_waiter->pid;
+ /*
+ * The effective policy depends on the current policy of
+ * the target task.
+ */
+ __entry->new_policy = effective_policy(
+ tsk->policy, top_waiter->prio);
+ __entry->new_nice = task_nice(top_waiter);
+ __entry->new_rt_priority = effective_rt_prio(
+ top_waiter->prio);
+ __entry->new_dl_runtime = dl_prio(top_waiter->prio) ?
+ top_waiter->dl.dl_runtime : 0;
+ __entry->new_dl_deadline = dl_prio(top_waiter->prio) ?
+ top_waiter->dl.dl_deadline : 0;
+ __entry->new_dl_period = dl_prio(top_waiter->prio) ?
+ top_waiter->dl.dl_period : 0;
+ } else {
+ __entry->top_waiter_comm[0] = '\0';
+ __entry->top_waiter_pid = -1;
+ __entry->new_policy = 0;
+ __entry->new_nice = 0;
+ __entry->new_rt_priority = 0;
+ __entry->new_dl_runtime = 0;
+ __entry->new_dl_deadline = 0;
+ __entry->new_dl_period = 0;
+ }
+ ),
+
+ TP_printk("comm=%s, pid=%d, old_policy=%s, old_nice=%d, "
+ "old_rt_priority=%u, old_dl_runtime=%Lu, "
+ "old_dl_deadline=%Lu, old_dl_period=%Lu, "
+ "top_waiter_comm=%s, top_waiter_pid=%d, new_policy=%s, "
+ "new_nice=%d, new_rt_priority=%u, "
+ "new_dl_runtime=%Lu, new_dl_deadline=%Lu, "
+ "new_dl_period=%Lu",
+ __entry->comm, __entry->pid,
+ __print_symbolic(__entry->old_policy, SCHEDULING_POLICY),
+ __entry->old_nice, __entry->old_rt_priority,
+ __entry->old_dl_runtime, __entry->old_dl_deadline,
+ __entry->old_dl_period,
+ __entry->top_waiter_comm, __entry->top_waiter_pid,
+ __entry->new_policy >= 0 ?
+ __print_symbolic(__entry->new_policy,
+ SCHEDULING_POLICY) : "",
+ __entry->new_nice, __entry->new_rt_priority,
+ __entry->new_dl_runtime, __entry->new_dl_deadline,
+ __entry->new_dl_period)
+);
+
#ifdef CONFIG_DETECT_HUNG_TASK
TRACE_EVENT(sched_process_hang,
TP_PROTO(struct task_struct *tsk),
--
1.9.1
next prev parent reply other threads:[~2016-09-23 16:50 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-23 16:49 [RFC PATCH v2 0/5] Additional scheduling information in tracepoints Julien Desfossez
2016-09-23 16:49 ` [RFC PATCH v2 1/5] sched: get effective policy and rt_prio Julien Desfossez
2016-09-23 16:49 ` [RFC PATCH v2 2/5] tracing: add TRACE_EVENT_MAP Julien Desfossez
2016-09-23 16:49 ` [RFC PATCH v2 3/5] tracing: extend scheduling tracepoints Julien Desfossez
2016-09-23 16:49 ` Julien Desfossez [this message]
2016-09-23 16:49 ` [RFC PATCH v2 5/5] tracing: add sched_update_prio Julien Desfossez
2016-09-24 13:28 ` Mathieu Desnoyers
2016-09-26 12:27 ` [RFC PATCH v2 0/5] Additional scheduling information in tracepoints Peter Zijlstra
2016-09-26 19:37 ` Mathieu Desnoyers
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=1474649375-28056-5-git-send-email-jdesfossez@efficios.com \
--to=jdesfossez@efficios.com \
--cc=daolivei@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=tglx@linutronix.de \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox