[ltt-dev] [PATCH] Wakeup change state only if proc not running

Francis Giraldeau francis.giraldeau at usherbrooke.ca
Tue Jan 25 11:23:32 EST 2011


The event kernel.sched_try_wakeup can occur for process already running on the
CPU (in kernel/sched.c:try_to_wakeup). Hence, in this condition, this event
must not change the state of the process to LTTV_STATE_WAIT_CPU.
---
 lttv/lttv/state.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/lttv/lttv/state.c b/lttv/lttv/state.c
index bd3f64d..cdf5d26 100644
--- a/lttv/lttv/state.c
+++ b/lttv/lttv/state.c
@@ -2941,6 +2941,9 @@ static gboolean dump_softirq(void *hook_data, void *call_data)
 static gboolean sched_try_wakeup(void *hook_data, void *call_data)
 {
 	LttvTracefileState *s = (LttvTracefileState *)call_data;
+	guint cpu = s->cpu;
+	LttvTraceState *ts = (LttvTraceState*)s->parent.t_context;
+	LttvProcessState *running_process = ts->running_process[cpu];
 	LttEvent *e = ltt_tracefile_get_event(s->parent.tf);
 	LttvTraceHook *th = (LttvTraceHook *)hook_data;
 	LttvProcessState *process;
@@ -2954,8 +2957,11 @@ static gboolean sched_try_wakeup(void *hook_data, void *call_data)
 			(LttvTraceState*)s->parent.t_context,
 			woken_cpu, woken_pid,
 			&s->parent.timestamp);
-	process->state->s = LTTV_STATE_WAIT_CPU;
-	process->state->change = s->parent.timestamp;
+	if (running_process != process)
+	{
+		process->state->s = LTTV_STATE_WAIT_CPU;
+		process->state->change = s->parent.timestamp;
+	}
 
 	g_debug("Wakeup: process %d on CPU %u\n", woken_pid, woken_cpu);
 
-- 
1.7.1





More information about the lttng-dev mailing list