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

Francis Giraldeau francis.giraldeau at usherbrooke.ca
Tue Jan 25 13:29:49 EST 2011


The event kernel.sched_try_wakeup can occur for process already running (in
kernel/sched.c:try_to_wake_up). Hence, in this condition, this event must not
change the state of the process to LTTV_STATE_WAIT_CPU.

This patch supports SMP
---
 lttv/lttv/state.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/lttv/lttv/state.c b/lttv/lttv/state.c
index bd3f64d..938f23e 100644
--- a/lttv/lttv/state.c
+++ b/lttv/lttv/state.c
@@ -2954,8 +2954,12 @@ 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 (process->state->s == LTTV_STATE_WAIT || process->state->s == LTTV_STATE_WAIT_FORK)
+	{
+		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