Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1415401 > unrolled thread

Re: [RFC PATCH 2/2] tracing: add sched_set_prio tracepoint

Started byMathieu Desnoyers <mathieu.desnoyers@efficios.com>
First post2016-06-06 22:00 +0200
Last post2016-06-08 02:20 +0200
Articles 3 — 3 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [RFC PATCH 2/2] tracing: add sched_set_prio tracepoint Mathieu Desnoyers <mathieu.desnoyers@efficios.com> - 2016-06-06 22:00 +0200
    Re: [RFC PATCH 2/2] tracing: add sched_set_prio tracepoint Peter Zijlstra <peterz@infradead.org> - 2016-06-06 23:10 +0200
      Re: [RFC PATCH 2/2] tracing: add sched_set_prio tracepoint Daniel Bristot de Oliveira <daolivei@redhat.com> - 2016-06-08 02:20 +0200

#1415401 — Re: [RFC PATCH 2/2] tracing: add sched_set_prio tracepoint

FromMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Date2016-06-06 22:00 +0200
SubjectRe: [RFC PATCH 2/2] tracing: add sched_set_prio tracepoint
Message-ID<rH8QP-Oc-37@gated-at.bofh.it>
----- 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 <jdesfossez@efficios.com>
> 
> Reviewed-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>

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

[toc] | [next] | [standalone]


#1415451

FromPeter Zijlstra <peterz@infradead.org>
Date2016-06-06 23:10 +0200
Message-ID<rH9Wy-1Fh-35@gated-at.bofh.it>
In reply to#1415401
On Mon, Jun 06, 2016 at 07:52:00PM +0000, Mathieu Desnoyers wrote:
> ----- On May 30, 2016, at 9:18 AM, Mathieu Desnoyers mathieu.desnoyers@efficios.com wrote:

> Adding Ingo and Peter in CC, considering that it touches to tracing and
> the scheduler.

> >> +/*
> >> + * 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));
> >> +

Nak on anything that cannot fundamentally deal with SCHED_DEADLINE.

[toc] | [prev] | [next] | [standalone]


#1416770

FromDaniel Bristot de Oliveira <daolivei@redhat.com>
Date2016-06-08 02:20 +0200
Message-ID<rHznX-1aY-3@gated-at.bofh.it>
In reply to#1415451
On 06/06/2016 06:03 PM, Peter Zijlstra wrote:
>>>> > >> +/*
>>>> > >> + * 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));
>>>> > >> +
> Nak on anything that cannot fundamentally deal with SCHED_DEADLINE.

My 2 cents: I liked the idea... But, I agree with peterz. This cannot
fundamentally deal with deadline scheduler.

In the deadline scheduler, the priority is set at every new sporadic
activation of the task (it is a fixed job priority scheduler - not a
fixed priority scheduler). The priority is the deadline of the new job.
The deadline is an u64, that does not fit in the int prio - so it cannot
be reused.

-- Daniel

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web