sched,tracing: Correct trace_sched_pi_setprio() for deboosting
PATCH 1/1 sched,tracing: Correct trace_sched_pi_setprio() for deboosting
This mostly a revert of commit b91473ff6e97 ("sched,tracing: Update trace_sched_pi_setprio()") except for the XXX comments.
Since that commit I see during a deboost a task this:
|futex sched_pi_setprio: comm=futex_requeue_p pid=2234 oldprio=98 newprio=98 |futex sched_switch: prev_comm=futex_requeue_p prev_pid=2234 prev_prio=120
and after the revert, the `newprio' shows the correct value again:
|futex sched_pi_setprio: comm=futex_requeue_p pid=2220 oldprio=98 newprio=120 |futex sched_switch: prev_comm=futex_requeue_p prev_pid=2220 prev_prio=120
--- include/trace/events/sched.h | 6 +++--- kernel/sched/core.c | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-)
include/trace/events/sched.h +3 -3
@@ -420,9 +420,9 @@ DEFINE_EVENT(sched_stat_runtime, sched_stat_runtime,*/ TRACE_EVENT(sched_pi_setprio, - TP_PROTO(struct task_struct *tsk, struct task_struct *pi_task), + TP_PROTO(struct task_struct *tsk, int new_prio), - TP_ARGS(tsk, pi_task), + TP_ARGS(tsk, new_prio), TP_STRUCT__entry( __array( char, comm, TASK_COMM_LEN )
@@ -435,7 +435,7 @@ TRACE_EVENT(sched_pi_setprio,memcpy (__entry->comm, tsk->comm,TASK_COMM_LEN ); __entry->pid = tsk->pid; __entry->oldprio = tsk->prio; - __entry->newprio = pi_task ? pi_task->prio : tsk->prio; + __entry->newprio = new_prio;/* XXX SCHED_DEADLINE bits missing */ ),
kernel/sched/core.c +1 -1
@@ -3823,7 +3823,7 @@ void rt_mutex_setprio(struct task_struct *p, struct task_struct *pi_task) goto out_unlock; } -trace_sched_pi_setprio (p, pi_task); +trace_sched_pi_setprio (p, prio); oldprio = p->prio;if (oldprio == prio)
Signature · 1 line
2.17.0
Peter Zijlstra
maintainerQuoted 23 lines · Sebastian Andrzej Siewior
Since that commit I see during a deboost a task this:
|futexsched_pi_setprio: comm=futex_requeue_p pid=2234 oldprio=98 newprio=98 |futexsched_switch: prev_comm=futex_requeue_p prev_pid=2234 prev_prio=120and after the revert, the `newprio' shows the correct value again:
|futex
sched_pi_setprio: comm=futex_requeue_p pid=2220 oldprio=98 newprio=120 |futexsched_switch: prev_comm=futex_requeue_p prev_pid=2220 prev_prio=120include/trace/events/sched.h +1
-1@@ -435,7 +435,7 @@ TRACE_EVENT(sched_pi_setprio,memcpy (__entry->comm, tsk->comm,TASK_COMM_LEN ); __entry->pid = tsk->pid; __entry->oldprio = tsk->prio; - __entry->newprio = pi_task ? pi_task->prio : tsk->prio; + __entry->newprio = new_prio;/* XXX SCHED_DEADLINE bits missing */ ),kernel/sched/core.c +0
-0
kernel/sched/core.c void rt_mutex_setprio(struct task_struct *p, struct task_struct *pi_task) · line 3826
Quoted 5 lines
kernel/sched/core.c +1
-1@@ -3823,7 +3823,7 @@ void rt_mutex_setprio(struct task_struct *p, struct task_struct *pi_task) goto out_unlock; } -trace_sched_pi_setprio (p, pi_task); +trace_sched_pi_setprio (p, prio);
at this point:
prio = pi_task ? min(p->normal_prio, pi->task->prio) : p->normal_prio;
(aka __rt_effective_prio)
Should we put that in the tracepoint instead?
Quoted 3 lines
kernel/sched/core.c +0
-0oldprio = p->prio;if (oldprio == prio)
Quoted 33 lines · Peter Zijlstra
Quoted 23 lines · Sebastian Andrzej Siewior
Since that commit I see during a deboost a task this:
|futexsched_pi_setprio: comm=futex_requeue_p pid=2234 oldprio=98 newprio=98 |futexsched_switch: prev_comm=futex_requeue_p prev_pid=2234 prev_prio=120and after the revert, the `newprio' shows the correct value again:
|futex
sched_pi_setprio: comm=futex_requeue_p pid=2220 oldprio=98 newprio=120 |futexsched_switch: prev_comm=futex_requeue_p prev_pid=2220 prev_prio=120include/trace/events/sched.h +1
-1@@ -435,7 +435,7 @@ TRACE_EVENT(sched_pi_setprio,memcpy (__entry->comm, tsk->comm,TASK_COMM_LEN ); __entry->pid = tsk->pid; __entry->oldprio = tsk->prio; - __entry->newprio = pi_task ? pi_task->prio : tsk->prio; + __entry->newprio = new_prio;/* XXX SCHED_DEADLINE bits missing */ ),kernel/sched/core.c +0
-0kernel/sched/core.c void rt_mutex_setprio(struct task_struct *p, struct task_struct *pi_task) · line 3826
Quoted 5 lines
kernel/sched/core.c +1
-1@@ -3823,7 +3823,7 @@ void rt_mutex_setprio(struct task_struct *p, struct task_struct *pi_task) goto out_unlock; } -trace_sched_pi_setprio (p, pi_task); +trace_sched_pi_setprio (p, prio);at this point:
Quoted 5 lines
prio = pi_task ? min(p->normal_prio, pi->task->prio) : p->normal_prio;(aka
__rt_effective_prio)Should we put that in the tracepoint instead?
I don't see the point in open coding __rt_effective_prio() and recomputing the value we already have. I'm a little worried that if something happens to `prio' we might miss it and notice later while debugging.
However, if they are reasons like breaking the trace-API for $tools, I can update it.
Sebastian
Peter Zijlstra
maintainerQuoted 11 lines · Sebastian Andrzej Siewior
Quoted 10 lines · Peter Zijlstra
Quoted 8 lines · Sebastian Andrzej Siewior
kernel/sched/core.c +0
-0@@ -3823,7 +3823,7 @@ void rt_mutex_setprio(struct task_struct *p, struct task_struct *pi_task) goto out_unlock; }
Quoted 9 lines
Quoted 2 lines
kernel/sched/core.c void rt_mutex_setprio(struct task_struct *p, struct task_struct *pi_task) · line 3826
Quoted 2 lines
kernel/sched/core.c +1
-1-trace_sched_pi_setprio (p, pi_task); +trace_sched_pi_setprio (p, prio);I don't see the point in open coding
__rt_effective_prio()and recomputing the value we already have. I'm a little worried that if something happens to `prio' we might miss it and notice later while debugging.
However, if they are reasons like breaking the trace-API for $tools, I can update it.
Thing is, with the pi_task as an argument, someone using the tracehook can actually get the deadline data out, even if the normal 'event' does not.
Quoted 3 lines · Peter Zijlstra
Thing is, with the
pi_taskas an argument, someone using the tracehook can actually get the deadline data out, even if the normal 'event' does not.
Okay, in that case an update will follow shortly.
Sebastian
PATCH v2 1/1 sched,tracing: Correct trace_sched_pi_setprio() for deboosting
In reply to Peter ZijlstraSince commit b91473ff6e97 ("sched,tracing: Update trace_sched_pi_setprio()") the sched_pi_setprio trace point shows the "newprio" during a deboost:
|futex sched_pi_setprio: comm=futex_requeue_p pid=2234 oldprio=98 newprio=98 |futex sched_switch: prev_comm=futex_requeue_p prev_pid=2234 prev_prio=120
This patch open codes __rt_effective_prio() in the tracepoint as the `newprio' to get the old behaviour back / the correct priority:
|futex sched_pi_setprio: comm=futex_requeue_p pid=2220 oldprio=98 newprio=120 |futex sched_switch: prev_comm=futex_requeue_p prev_pid=2220 prev_prio=120
Peter suggested to open code the new priority so people using tracehook could get the deadline data out.
---
v1…v2: Open code __rt_effective_prio() in sched_pi_setprio macro as suggested by PeterZ.
include/trace/events/sched.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
include/trace/events/sched.h +3 -1
@@ -435,7 +435,9 @@ TRACE_EVENT(sched_pi_setprio,memcpy (__entry->comm, tsk->comm,TASK_COMM_LEN ); __entry->pid = tsk->pid; __entry->oldprio = tsk->prio; - __entry->newprio = pi_task ? pi_task->prio : tsk->prio; + __entry->newprio = pi_task ? +min (tsk->normal_prio, pi_task->prio) : + tsk->normal_prio;/* XXX SCHED_DEADLINE bits missing */ ),
Signature · 1 line
2.17.0
tip-bot for Sebastian Andrzej Siewior
merge bot[tip:sched/core] sched, tracing: Fix trace_sched_pi_setprio() for deboosting
sched, tracing: Fix trace_sched_pi_setprio() for deboosting
Commit-ID: 4ff648decf4712d39f184fc2df3163f43975575a Gitweb: https://git.kernel.org/tip/4ff648decf4712d39f184fc2df3163f43975575a Author: Sebastian Andrzej Siewior <[email protected]> AuthorDate: Thu, 24 May 2018 15:26:48 +0200 Committer: Ingo Molnar <[email protected]> CommitDate: Fri, 25 May 2018 08:04:01 +0200
sched, tracing: Fix trace_sched_pi_setprio() for deboosting
Since the following commit:
b91473ff6e97 ("sched,tracing: Update trace_sched_pi_setprio()")
the sched_pi_setprio trace point shows the "newprio" during a deboost:
|futex sched_pi_setprio: comm=futex_requeue_p pid"34 oldprio newprio=3D98 |futex sched_switch: prev_comm=futex_requeue_p prev_pid"34 prev_prio=120
This patch open codes __rt_effective_prio() in the tracepoint as the 'newprio' to get the old behaviour back / the correct priority:
|futex sched_pi_setprio: comm=futex_requeue_p pid"20 oldprio newprio=3D120 |futex sched_switch: prev_comm=futex_requeue_p prev_pid"20 prev_prio=120
Peter suggested to open code the new priority so people using tracehook could get the deadline data out.
--- include/trace/events/sched.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
include/trace/events/sched.h +3 -1
@@ -435,7 +435,9 @@ TRACE_EVENT(sched_pi_setprio,memcpy (__entry->comm, tsk->comm,TASK_COMM_LEN ); __entry->pid = tsk->pid; __entry->oldprio = tsk->prio; - __entry->newprio = pi_task ? pi_task->prio : tsk->prio; + __entry->newprio = pi_task ? +min (tsk->normal_prio, pi_task->prio) : + tsk->normal_prio;/* XXX SCHED_DEADLINE bits missing */ ),
Re: [tip:sched/core] sched, tracing: Fix trace_sched_pi_setprio() for deboosting
Quoted 9 lines · tip-bot for Sebastian Andrzej Siewior
Commit-ID: 4ff648decf4712d39f184fc2df3163f43975575a Gitweb: https://git.kernel.org/tip/4ff648decf4712d39f184fc2df3163f43975575a Author: Sebastian Andrzej Siewior <[email protected]> AuthorDate: Thu, 24 May 2018 15:26:48 +0200 Committer: Ingo Molnar <[email protected]> CommitDate: Fri, 25 May 2018 08:04:01 +0200sched, tracing: Fix
trace_sched_pi_setprio()for deboosting
Quoted 8 lines
Since the following commit:
b91473ff6e97("sched,tracing: Updatetrace_sched_pi_setprio()")the
sched_pi_setpriotrace point shows the "newprio" during a deboost:|futex
sched_pi_setprio: comm=futex_requeue_p pid"34 oldprio newprio=3D98 |futexsched_switch: prev_comm=futex_requeue_p prev_pid"34 prev_prio=120
pid=2234 got turned into pid"34 the same for other fields.
Sebastian