sched: don't account latency of newly forking task
sched_task_util_* trace events account latency of select_task_rq_fair()
by using p->ravg.mark_start which isn't set for newly forking tasks.
Don't account latency when mark_start isn't set.
Change-Id: Icdd5acb1969cbe71a57f580f9d9bb8a46e329832
Signed-off-by: Joonwoo Park <joonwoop@codeaurora.org>
diff --git a/include/trace/events/sched.h b/include/trace/events/sched.h
index 4a9c625..7903e95 100644
--- a/include/trace/events/sched.h
+++ b/include/trace/events/sched.h
@@ -862,7 +862,9 @@ DECLARE_EVENT_CLASS(sched_task_util,
__entry->target_cpu = target_cpu;
__entry->ediff = ediff;
__entry->need_idle = need_idle;
- __entry->latency = sched_ktime_clock() - p->ravg.mark_start;
+ __entry->latency = p->ravg.mark_start ?
+ sched_ktime_clock() -
+ p->ravg.mark_start : 0;
),
TP_printk("comm=%s pid=%d task_cpu=%d task_util=%lu nominated_cpu=%d target_cpu=%d energy_diff=%d need_idle=%d latency=%llu",