Skip to contentSkip to conversation

sched: trace: update trace_sched_wakeup()

PATCH Applied Peter Zijlstra 3 participants 6 messages Dec 16, 2008

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Add the information needed to distinguish 'real' wakeups from 'false' wakeups.

---
 include/trace/sched.h             |    4 ++--
 kernel/sched.c                    |    2 +-
 kernel/trace/trace_sched_switch.c |    2 +-
 kernel/trace/trace_sched_wakeup.c |    2 +-
 4 files changed, 5 insertions(+), 5 deletions(-)
include/trace/sched.h +2 -2
index 9b2854a..a0861d2 100644
@@ -17,8 +17,8 @@ DECLARE_TRACE(sched_wait_task,
 		TPARGS(rq, p));
 
 DECLARE_TRACE(sched_wakeup,
-	TPPROTO(struct rq *rq, struct task_struct *p),
-		TPARGS(rq, p));
+	TPPROTO(struct rq *rq, struct task_struct *p, int success),
+		TPARGS(rq, p, success));
 
 DECLARE_TRACE(sched_wakeup_new,
 	TPPROTO(struct rq *rq, struct task_struct *p),
kernel/sched.c +1 -1
index 0eff15b..953ded9 100644
@@ -2329,7 +2329,7 @@ out_activate:
 	success = 1;
 
 out_running:
-	trace_sched_wakeup(rq, p);
+	trace_sched_wakeup(rq, p, success);
 	check_preempt_curr(rq, p, sync);
 
 	p->state = TASK_RUNNING;
kernel/trace/trace_sched_switch.c +1 -1
index 8633905..d4db564 100644
@@ -49,7 +49,7 @@ probe_sched_switch(struct rq *__rq, struct task_struct *prev,
 }
 
 static void
-probe_sched_wakeup(struct rq *__rq, struct task_struct *wakee)
+probe_sched_wakeup(struct rq *__rq, struct task_struct *wakee, int success)
 {
 	struct trace_array_cpu *data;
 	unsigned long flags;
kernel/trace/trace_sched_wakeup.c +1 -1
index 0067b49..43586b6 100644
@@ -211,7 +211,7 @@ static void wakeup_reset(struct trace_array *tr)
 }
 
 static void
-probe_wakeup(struct rq *rq, struct task_struct *p)
+probe_wakeup(struct rq *rq, struct task_struct *p, int success)
 {
 	int cpu = smp_processor_id();
 	unsigned long flags;
#1 lore raw
Quoted 2 lines · Peter Zijlstra

Add the information needed to distinguish 'real' wakeups from 'false' wakeups.

I don't seem to be doing so well this morning...

Thanks Dhaval!

Quoted 67 lines
---
 include/trace/sched.h             |    4 ++--
 kernel/sched.c                    |    2 +-
 kernel/trace/trace_sched_switch.c |    2 +-
 kernel/trace/trace_sched_wakeup.c |    2 +-
 4 files changed, 5 insertions(+), 5 deletions(-)
include/trace/sched.h +2 -2
index 9b2854a..a0861d2 100644
@@ -17,8 +17,8 @@ DECLARE_TRACE(sched_wait_task,
 		TPARGS(rq, p));
 
 DECLARE_TRACE(sched_wakeup,
-	TPPROTO(struct rq *rq, struct task_struct *p),
-		TPARGS(rq, p));
+	TPPROTO(struct rq *rq, struct task_struct *p, int success),
+		TPARGS(rq, p, success));
 
 DECLARE_TRACE(sched_wakeup_new,
 	TPPROTO(struct rq *rq, struct task_struct *p),
kernel/sched.c +1 -1
index 0eff15b..953ded9 100644
@@ -2329,7 +2329,7 @@ out_activate:
 	success = 1;
 
 out_running:
-	trace_sched_wakeup(rq, p);
+	trace_sched_wakeup(rq, p, success);
 	check_preempt_curr(rq, p, sync);
 
 	p->state = TASK_RUNNING;
kernel/trace/trace_sched_switch.c +1 -1
index 8633905..d4db564 100644
@@ -49,7 +49,7 @@ probe_sched_switch(struct rq *__rq, struct task_struct *prev,
 }
 
 static void
-probe_sched_wakeup(struct rq *__rq, struct task_struct *wakee)
+probe_sched_wakeup(struct rq *__rq, struct task_struct *wakee, int success)
 {
 	struct trace_array_cpu *data;
 	unsigned long flags;
kernel/trace/trace_sched_wakeup.c +1 -2
index 0067b49..43586b6 100644
@@ -211,7 +211,7 @@ static void wakeup_reset(struct trace_array *tr)
 }
 
 static void
-probe_wakeup(struct rq *rq, struct task_struct *p)
+probe_wakeup(struct rq *rq, struct task_struct *p, int success)
 {
 	int cpu = smp_processor_id();
 	unsigned long flags;
 
--

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

Applied
#2 lore raw
Quoted 9 lines · Peter Zijlstra
Quoted 2 lines · Peter Zijlstra

Add the information needed to distinguish 'real' wakeups from 'false' wakeups.

I don't seem to be doing so well this morning...

Thanks Dhaval!

applied to tip/tracing/ftrace, thanks Peter!

I suspect you'll also then use this bit in the ftrace scheduler records? This extension is pretty orphaned right now.

Ingo

#3 lore raw
In reply to Peter Zijlstra
Quoted 10 lines · * Peter Zijlstra ([email protected]) wrote:
Quoted 2 lines · Peter Zijlstra

Add the information needed to distinguish 'real' wakeups from 'false' wakeups.

I don't seem to be doing so well this morning...

Thanks Dhaval!

Applied a modified version into the 2.6.27.9 LTTng tree. Thanks! (remembering that I should really move to 2.6.28-rc!)

Mathieu

Quoted 67 lines
Quoted 67 lines
---
 include/trace/sched.h             |    4 ++--
 kernel/sched.c                    |    2 +-
 kernel/trace/trace_sched_switch.c |    2 +-
 kernel/trace/trace_sched_wakeup.c |    2 +-
 4 files changed, 5 insertions(+), 5 deletions(-)
include/trace/sched.h +2 -2
index 9b2854a..a0861d2 100644
@@ -17,8 +17,8 @@ DECLARE_TRACE(sched_wait_task,
 		TPARGS(rq, p));
 
 DECLARE_TRACE(sched_wakeup,
-	TPPROTO(struct rq *rq, struct task_struct *p),
-		TPARGS(rq, p));
+	TPPROTO(struct rq *rq, struct task_struct *p, int success),
+		TPARGS(rq, p, success));
 
 DECLARE_TRACE(sched_wakeup_new,
 	TPPROTO(struct rq *rq, struct task_struct *p),
kernel/sched.c +1 -1
index 0eff15b..953ded9 100644
@@ -2329,7 +2329,7 @@ out_activate:
 	success = 1;
 
 out_running:
-	trace_sched_wakeup(rq, p);
+	trace_sched_wakeup(rq, p, success);
 	check_preempt_curr(rq, p, sync);
 
 	p->state = TASK_RUNNING;
kernel/trace/trace_sched_switch.c +1 -1
index 8633905..d4db564 100644
@@ -49,7 +49,7 @@ probe_sched_switch(struct rq *__rq, struct task_struct *prev,
 }
 
 static void
-probe_sched_wakeup(struct rq *__rq, struct task_struct *wakee)
+probe_sched_wakeup(struct rq *__rq, struct task_struct *wakee, int success)
 {
 	struct trace_array_cpu *data;
 	unsigned long flags;
kernel/trace/trace_sched_wakeup.c +1 -2
index 0067b49..43586b6 100644
@@ -211,7 +211,7 @@ static void wakeup_reset(struct trace_array *tr)
 }
 
 static void
-probe_wakeup(struct rq *rq, struct task_struct *p)
+probe_wakeup(struct rq *rq, struct task_struct *p, int success)
 {
 	int cpu = smp_processor_id();
 	unsigned long flags;
 
--

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

Signature · 2 lines
Mathieu Desnoyers
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F  BA06 3F25 A8FE 3BAE 9A68
#4 lore raw
Quoted 7 lines · Mathieu Desnoyers
Quoted 6 lines · * Peter Zijlstra ([email protected]) wrote:
Quoted 2 lines · Peter Zijlstra

Add the information needed to distinguish 'real' wakeups from 'false' wakeups.

I don't seem to be doing so well this morning...

Quoted 7 lines
Quoted 4 lines

Thanks Dhaval!

Applied a modified version into the 2.6.27.9 LTTng tree. Thanks! (remembering that I should really move to 2.6.28-rc!)

Ingo pointed out that this generates build crap in ftrace which made me look at the thing again, and I just realized we don't need it.

trace_sched_wakeup() gets called before we set p->state = TASK_RUNNING, so by checking p->state in the callback we can see if its a real of false wakeup.

The scheduler tracer in ftrace already exploits this.

Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
kernel/sched.c +1 -1
@@ -2329,7 +2329,7 @@ out_activate:
 	success = 1;
 
 out_running:
-	trace_sched_wakeup(rq, p);
+	trace_sched_wakeup(rq, p, success);
 	check_preempt_curr(rq, p, sync);
 
 	p->state = TASK_RUNNING;
#5 lore raw
Quoted 16 lines · * Peter Zijlstra ([email protected]) wrote:
Quoted 7 lines · Mathieu Desnoyers
Quoted 6 lines · * Peter Zijlstra ([email protected]) wrote:
Quoted 2 lines · Peter Zijlstra

Add the information needed to distinguish 'real' wakeups from 'false' wakeups.

I don't seem to be doing so well this morning...

Quoted 7 lines
Quoted 4 lines

Thanks Dhaval!

Applied a modified version into the 2.6.27.9 LTTng tree. Thanks! (remembering that I should really move to 2.6.28-rc!)

Quoted 9 lines

Ingo pointed out that this generates build crap in ftrace which made me look at the thing again, and I just realized we don't need it.

trace_sched_wakeup() gets called before we set p->state = TASK_RUNNING, so by checking p->state in the callback we can see if its a real of false wakeup.

The scheduler tracer in ftrace already exploits this.

We do something similar in LTTng : we save the state along with the event in the trace stream and let the userspace analyzer see what was the state of the process prior to the wakeup.

Thanks,

Mathieu

Quoted 13 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
kernel/sched.c +1 -1
@@ -2329,7 +2329,7 @@ out_activate:
 	success = 1;
 
 out_running:
-	trace_sched_wakeup(rq, p);
+	trace_sched_wakeup(rq, p, success);
 	check_preempt_curr(rq, p, sync);
 
 	p->state = TASK_RUNNING;
Signature · 2 lines
Mathieu Desnoyers
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F  BA06 3F25 A8FE 3BAE 9A68