From: Arun Sharma <asharma@fb.com>
To: <avagin@openvz.org>
Cc: <linux-kernel@vger.kernel.org>,
Peter Zijlstra <a.p.zijlstra@chello.nl>,
Steven Rostedt <rostedt@goodmis.org>,
Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
Arnaldo Carvalho de Melo <acme@infradead.org>,
Frederic Weisbecker <fweisbec@gmail.com>,
Ingo Molnar <mingo@elte.hu>
Subject: Re: [PATCH 2/2] tracing, sched: Add a new tracepoint for sleeptime
Date: Thu, 19 Jan 2012 14:30:37 -0800 [thread overview]
Message-ID: <4F18998D.30503@fb.com> (raw)
In-Reply-To: <4EF1B86D.9030809@openvz.org>
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
prev parent reply other threads:[~2012-01-19 22:32 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-20 18:09 [PATCH 0/2] Sleep Profiling v2 Arun Sharma
2011-12-20 18:09 ` [PATCH 1/2] sched: Retain sleep/block information Arun Sharma
2011-12-20 18:09 ` [PATCH 2/2] tracing, sched: Add a new tracepoint for sleeptime Arun Sharma
2011-12-20 18:16 ` Steven Rostedt
2011-12-20 18:22 ` Arun Sharma
2011-12-20 19:19 ` Steven Rostedt
2011-12-21 10:43 ` Andrey Vagin
2011-12-22 0:18 ` Arun Sharma
2012-01-19 22:30 ` Arun Sharma [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4F18998D.30503@fb.com \
--to=asharma@fb.com \
--cc=a.p.zijlstra@chello.nl \
--cc=acme@infradead.org \
--cc=avagin@openvz.org \
--cc=fweisbec@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=mingo@elte.hu \
--cc=rostedt@goodmis.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).