[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <4F18998D.30503@fb.com>
Date: Thu, 19 Jan 2012 14:30:37 -0800
From: Arun Sharma <asharma@...com>
To: <avagin@...nvz.org>
CC: <linux-kernel@...r.kernel.org>,
Peter Zijlstra <a.p.zijlstra@...llo.nl>,
Steven Rostedt <rostedt@...dmis.org>,
Mathieu Desnoyers <mathieu.desnoyers@...icios.com>,
Arnaldo Carvalho de Melo <acme@...radead.org>,
Frederic Weisbecker <fweisbec@...il.com>,
Ingo Molnar <mingo@...e.hu>
Subject: Re: [PATCH 2/2] tracing, sched: Add a new tracepoint for sleeptime
On 12/21/11 2:43 AM, Andrey Vagin wrote:
>
>>
>> +#ifdef CREATE_TRACE_POINTS
>> +static inline u64 trace_get_sleeptime(struct task_struct *tsk)
>> +{
>> +#ifdef CONFIG_SCHEDSTATS
>> + u64 block, sleep;
>> +
>> + block = tsk->se.statistics.block_start;
>> + sleep = tsk->se.statistics.sleep_start;
> Arun, probably you have missed one of my comments.
> block_start and sleep_start should be zeroized here.
>
> tsk->se.statistics.block_start = 0;
> tsk->se.statistics.sleep_start = 0;
This still doesn't solve one minor problem: the first sample we get
might be bad. Here's the sequence that could trigger it:
t1: task goes to sleep. sleep_start=t1
t2: task gets woken up. sleep_start is still t1
t3: context switch. trace_get_sleeptime() is not active. sleep_start is
still t1
t4: trace_get_sleeptime() is activated
t5: task gets context switched out involuntarily.
t6: task gets context switched in. first sample from the task.
We compute sleeptime=t6-t1. The correct answer should be sleeptime=0.
We should set {sleep,block}_start to 0 regardless of whether the
tracepoint is active or not.
I'll post a patch shortly.
-Arun
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists