From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752890AbcFFTwH (ORCPT ); Mon, 6 Jun 2016 15:52:07 -0400 Received: from mail.efficios.com ([78.47.125.74]:35710 "EHLO mail.efficios.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751510AbcFFTwE (ORCPT ); Mon, 6 Jun 2016 15:52:04 -0400 Date: Mon, 6 Jun 2016 19:52:00 +0000 (UTC) From: Mathieu Desnoyers To: Julien Desfossez , Ingo Molnar , Peter Zijlstra Cc: Thomas Gleixner , rostedt , linux-kernel@vger.kernel.org Message-ID: <1276244634.29549.1465242720729.JavaMail.zimbra@efficios.com> In-Reply-To: <1176128471.22690.1464614300448.JavaMail.zimbra@efficios.com> References: <1464362168-17064-1-git-send-email-jdesfossez@efficios.com> <1464362168-17064-2-git-send-email-jdesfossez@efficios.com> <1176128471.22690.1464614300448.JavaMail.zimbra@efficios.com> Subject: Re: [RFC PATCH 2/2] tracing: add sched_set_prio tracepoint MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Originating-IP: [78.47.125.74] X-Mailer: Zimbra 8.6.0_GA_1178 (ZimbraWebClient - FF46 (Linux)/8.6.0_GA_1178) Thread-Topic: tracing: add sched_set_prio tracepoint Thread-Index: jnbTyuNt0hhi+zoFgiSTpf1Lp5lohuIzJZ2Q Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org ----- On May 30, 2016, at 9:18 AM, Mathieu Desnoyers mathieu.desnoyers@efficios.com wrote: > ----- On May 27, 2016, at 5:16 PM, Julien Desfossez jdesfossez@efficios.com > wrote: > >> This tracepoint allows to keep track of all priority changes made by all >> sites that can change this value. The impacted system calls are >> sched_setscheduler, sched_setattr, sched_process_fork and set_user_nice. >> The priority inheritance mechanism from rt_mutex gets also instrumented >> with this tracepoint even though there is a dedicated tracepoint for it >> (sched_pi_setprio). >> >> This allows analysis of real-time scheduling delays per thread priority, >> which cannot be performed accurately if we only trace the priority of >> the currently scheduled processes. >> >> Here is an example of what is output by ftrace when we change the >> priority of a running process: >> sys_sched_setscheduler(pid: 1c52, policy: 2, param: 7ffc22e20980) >> sched_set_prio: comm=burnP6 pid=7250 oldprio=120 newprio=39 >> sys_sched_setscheduler -> 0x0 >> sched_switch: prev_comm=chrt prev_pid=7268 prev_prio=120 >> prev_state=R ==> next_comm=burnP6 next_pid=7250 >> next_prio=39 >> >> Signed-off-by: Julien Desfossez > > Reviewed-by: Mathieu Desnoyers Adding Ingo and Peter in CC, considering that it touches to tracing and the scheduler. Thanks, Mathieu > >> --- >> include/trace/events/sched.h | 21 ++++++++++++++++----- >> kernel/sched/core.c | 1 + >> 2 files changed, 17 insertions(+), 5 deletions(-) >> >> diff --git a/include/trace/events/sched.h b/include/trace/events/sched.h >> index 9b90c57..3b83ddb 100644 >> --- a/include/trace/events/sched.h >> +++ b/include/trace/events/sched.h >> @@ -407,11 +407,7 @@ DEFINE_EVENT(sched_stat_runtime, sched_stat_runtime, >> TP_PROTO(struct task_struct *tsk, u64 runtime, u64 vruntime), >> TP_ARGS(tsk, runtime, vruntime)); >> >> -/* >> - * Tracepoint for showing priority inheritance modifying a tasks >> - * priority. >> - */ >> -TRACE_EVENT(sched_pi_setprio, >> +DECLARE_EVENT_CLASS(sched_prio_template, >> >> TP_PROTO(struct task_struct *tsk, int newprio), >> >> @@ -436,6 +432,21 @@ TRACE_EVENT(sched_pi_setprio, >> __entry->oldprio, __entry->newprio) >> ); >> >> +/* >> + * Tracepoint for showing priority inheritance modifying a tasks >> + * priority. >> + */ >> +DEFINE_EVENT(sched_prio_template, sched_pi_setprio, >> + TP_PROTO(struct task_struct *tsk, int newprio), >> + TP_ARGS(tsk, newprio)); >> + >> +/* >> + * Tracepoint for priority changes of a task. >> + */ >> +DEFINE_EVENT(sched_prio_template, sched_set_prio, >> + TP_PROTO(struct task_struct *tsk, int newprio), >> + TP_ARGS(tsk, newprio)); >> + >> #ifdef CONFIG_DETECT_HUNG_TASK >> TRACE_EVENT(sched_process_hang, >> TP_PROTO(struct task_struct *tsk), >> diff --git a/kernel/sched/core.c b/kernel/sched/core.c >> index 6946b8f..45fbaab 100644 >> --- a/kernel/sched/core.c >> +++ b/kernel/sched/core.c >> @@ -2232,6 +2232,7 @@ int sysctl_schedstats(struct ctl_table *table, int write, >> >> static void sched_set_prio(struct task_struct *p, int prio) >> { >> + trace_sched_set_prio(p, prio); >> p->prio = prio; >> } >> >> -- >> 1.9.1 > > -- > Mathieu Desnoyers > EfficiOS Inc. > http://www.efficios.com -- Mathieu Desnoyers EfficiOS Inc. http://www.efficios.com