ANDROID: trace: sched: add sched blocked tracepoint which dumps out context of sleep.

Declare war on uninterruptible sleep. Add a tracepoint which
walks the kernel stack and dumps the first non-scheduler function
called before the scheduler is invoked.

Bug: 120445457
Change-Id: I19e965d5206329360a92cbfe2afcc8c30f65c229
Signed-off-by: Riley Andrews <riandrews@google.com>
[astrachan: deleted an unnecessary whitespace change]
Signed-off-by: Alistair Strachan <astrachan@google.com>
Bug: 170916884
Signed-off-by: Todd Kjos <tkjos@google.com>
This commit is contained in:
Riley Andrews 2015-10-02 00:39:53 -07:00 committed by Todd Kjos
parent c2ad8d4b00
commit 8540985fd2
2 changed files with 25 additions and 0 deletions
include/trace/events
kernel/sched

View File

@ -402,6 +402,30 @@ DEFINE_EVENT_SCHEDSTAT(sched_stat_template, sched_stat_blocked,
TP_PROTO(struct task_struct *tsk, u64 delay),
TP_ARGS(tsk, delay));
/*
* Tracepoint for recording the cause of uninterruptible sleep.
*/
TRACE_EVENT(sched_blocked_reason,
TP_PROTO(struct task_struct *tsk),
TP_ARGS(tsk),
TP_STRUCT__entry(
__field( pid_t, pid )
__field( void*, caller )
__field( bool, io_wait )
),
TP_fast_assign(
__entry->pid = tsk->pid;
__entry->caller = (void *)get_wchan(tsk);
__entry->io_wait = tsk->in_iowait;
),
TP_printk("pid=%d iowait=%d caller=%pS", __entry->pid, __entry->io_wait, __entry->caller)
);
/*
* Tracepoint for accounting runtime (time the task is executing
* on a CPU).

View File

@ -973,6 +973,7 @@ update_stats_enqueue_sleeper(struct cfs_rq *cfs_rq, struct sched_entity *se)
}
trace_sched_stat_blocked(tsk, delta);
trace_sched_blocked_reason(tsk);
/*
* Blocking time is in units of nanosecs, so shift by