Skip to contentSkip to conversation

sched,trace: Allow tracing the preemption decision on wakeup

PATCH In review Peter Zijlstra 4 participants 4 messages Mar 14, 2013 – Mar 18, 2013 Scheduler

lore
Share & tools
lore

Peter Zijlstra

author maintainer
#0 lore raw

PATCH 1/1 sched,trace: Allow tracing the preemption decision on wakeup

Thomas noted that we do the wakeup preemption check after the wakeup trace point, this means the tracepoint cannot test/report this decision; which is rather important for latency sensitive workloads. Therefore move the tracepoint after doing the preemption check.

---
 kernel/sched/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/sched/core.c +1 -1
index b36635e..849deb9 100644
@@ -1288,8 +1288,8 @@ static void ttwu_activate(struct rq *rq, struct task_struct *p, int en_flags)
 static void
 ttwu_do_wakeup(struct rq *rq, struct task_struct *p, int wake_flags)
 {
-	trace_sched_wakeup(p, true);
 	check_preempt_curr(rq, p, wake_flags);
+	trace_sched_wakeup(p, true);
 
 	p->state = TASK_RUNNING;
 #ifdef CONFIG_SMP
reviewer Acked-by on v1 1/1
#1 lore raw
Quoted 7 lines · Peter Zijlstra

Thomas noted that we do the wakeup preemption check after the wakeup trace point, this means the tracepoint cannot test/report this decision; which is rather important for latency sensitive workloads. Therefore move the tracepoint after doing the preemption check.

Quoted 19 lines
---
 kernel/sched/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/sched/core.c +1 -1
index b36635e..849deb9 100644
@@ -1288,8 +1288,8 @@ static void ttwu_activate(struct rq *rq, struct task_struct *p, int en_flags)
 static void
 ttwu_do_wakeup(struct rq *rq, struct task_struct *p, int wake_flags)
 {
-	trace_sched_wakeup(p, true);
 	check_preempt_curr(rq, p, wake_flags);
+	trace_sched_wakeup(p, true);
 
 	p->state = TASK_RUNNING;
 #ifdef CONFIG_SMP
#2 lore raw

Yeah -- this one is a real no brainer to move; looks good :)

Quoted 32 lines · Steven Rostedt
Quoted 7 lines · Peter Zijlstra

Thomas noted that we do the wakeup preemption check after the wakeup trace point, this means the tracepoint cannot test/report this decision; which is rather important for latency sensitive workloads. Therefore move the tracepoint after doing the preemption check.

Quoted 19 lines
---
 kernel/sched/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/sched/core.c +1 -1
index b36635e..849deb9 100644
@@ -1288,8 +1288,8 @@ static void ttwu_activate(struct rq *rq, struct task_struct *p, int en_flags)
 static void
 ttwu_do_wakeup(struct rq *rq, struct task_struct *p, int wake_flags)
 {
-     trace_sched_wakeup(p, true);
      check_preempt_curr(rq, p, wake_flags);
+     trace_sched_wakeup(p, true);
 
      p->state = TASK_RUNNING;
 #ifdef CONFIG_SMP
#3 lore raw

[tip:sched/core] sched/tracing: Allow tracing the preemption decision on wakeup

In reply to Peter Zijlstra
sched/tracing: Allow tracing the preemption decision on wakeup
Commit-ID:  a8d7ad52a7befbde896276d05c75c90fed48b5bf
Gitweb:     http://git.kernel.org/tip/a8d7ad52a7befbde896276d05c75c90fed48b5bf
Author:     Peter Zijlstra <[email protected]>
AuthorDate: Thu, 14 Mar 2013 10:48:39 +0100
Committer:  Ingo Molnar <[email protected]>
CommitDate: Mon, 18 Mar 2013 10:18:08 +0100

sched/tracing: Allow tracing the preemption decision on wakeup

Thomas noted that we do the wakeup preemption check after the wakeup trace point, this means the tracepoint cannot test/report this decision; which is rather important for latency sensitive workloads. Therefore move the tracepoint after doing the preemption check.

---
 kernel/sched/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/sched/core.c +1 -1
index b36635e..849deb9 100644
@@ -1288,8 +1288,8 @@ static void ttwu_activate(struct rq *rq, struct task_struct *p, int en_flags)
 static void
 ttwu_do_wakeup(struct rq *rq, struct task_struct *p, int wake_flags)
 {
-	trace_sched_wakeup(p, true);
 	check_preempt_curr(rq, p, wake_flags);
+	trace_sched_wakeup(p, true);
 
 	p->state = TASK_RUNNING;
 #ifdef CONFIG_SMP