[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1474060148-13171-6-git-send-email-jdesfossez@efficios.com>
Date: Fri, 16 Sep 2016 17:09:08 -0400
From: Julien Desfossez <jdesfossez@...icios.com>
To: peterz@...radead.org, tglx@...utronix.de, rostedt@...dmis.org,
mingo@...hat.com, daolivei@...hat.com
Cc: mathieu.desnoyers@...icios.com, linux-kernel@...r.kernel.org,
Julien Desfossez <jdesfossez@...icios.com>
Subject: [RFC PATCH 6/6] tracing: extend sched_pi_setprio
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@...radead.org>
Cc: Steven Rostedt (Red Hat) <rostedt@...dmis.org>
Cc: Thomas Gleixner <tglx@...utronix.de>
Cc: Ingo Molnar <mingo@...hat.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@...icios.com>
Signed-off-by: Julien Desfossez <jdesfossez@...icios.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 11b3358..c69ee74 100644
--- a/include/trace/events/sched.h
+++ b/include/trace/events/sched.h
@@ -686,6 +686,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 = rt_mutex_get_effective_policy(
+ tsk->policy, tsk->prio);
+ __entry->old_nice = task_nice(tsk);
+ __entry->old_rt_priority = rt_mutex_get_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 = rt_mutex_get_effective_policy(
+ tsk->policy, top_waiter->prio);
+ __entry->new_nice = task_nice(top_waiter);
+ __entry->new_rt_priority = rt_mutex_get_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
Powered by blists - more mailing lists