aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOleg Nesterov <oleg@redhat.com>2013-10-19 12:18:28 -0400
committerIngo Molnar <mingo@kernel.org>2013-10-31 06:16:18 -0400
commit6a716c90a51338009c3bc1f460829afaed8f922d (patch)
tree85e821a30e0f9350a2b67ff94d758632eec92689
parent4c4e4f61368164f326fe59e2156c70d7faa72c17 (diff)
hung_task debugging: Add tracepoint to report the hang
Currently check_hung_task() prints a warning if it detects the problem, but it is not convenient to watch the system logs if user-space wants to be notified about the hang. Add the new trace_sched_process_hang() into check_hung_task(), this way a user-space monitor can easily wait for the hang and potentially resolve a problem. Signed-off-by: Oleg Nesterov <oleg@redhat.com> Cc: Dave Sullivan <dsulliva@redhat.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Steven Rostedt <rostedt@goodmis.org> Link: http://lkml.kernel.org/r/20131019161828.GA7439@redhat.com Signed-off-by: Ingo Molnar <mingo@kernel.org>
-rw-r--r--include/trace/events/sched.h19
-rw-r--r--kernel/hung_task.c4
2 files changed, 23 insertions, 0 deletions
diff --git a/include/trace/events/sched.h b/include/trace/events/sched.h
index 2e7d9947a10d..2a652d124fbb 100644
--- a/include/trace/events/sched.h
+++ b/include/trace/events/sched.h
@@ -424,6 +424,25 @@ TRACE_EVENT(sched_pi_setprio,
424 __entry->oldprio, __entry->newprio) 424 __entry->oldprio, __entry->newprio)
425); 425);
426 426
427#ifdef CONFIG_DETECT_HUNG_TASK
428TRACE_EVENT(sched_process_hang,
429 TP_PROTO(struct task_struct *tsk),
430 TP_ARGS(tsk),
431
432 TP_STRUCT__entry(
433 __array( char, comm, TASK_COMM_LEN )
434 __field( pid_t, pid )
435 ),
436
437 TP_fast_assign(
438 memcpy(__entry->comm, tsk->comm, TASK_COMM_LEN);
439 __entry->pid = tsk->pid;
440 ),
441
442 TP_printk("comm=%s pid=%d", __entry->comm, __entry->pid)
443);
444#endif /* CONFIG_DETECT_HUNG_TASK */
445
427#endif /* _TRACE_SCHED_H */ 446#endif /* _TRACE_SCHED_H */
428 447
429/* This part must be outside protection */ 448/* This part must be outside protection */
diff --git a/kernel/hung_task.c b/kernel/hung_task.c
index 042252383fd2..8807061ca004 100644
--- a/kernel/hung_task.c
+++ b/kernel/hung_task.c
@@ -16,6 +16,7 @@
16#include <linux/export.h> 16#include <linux/export.h>
17#include <linux/sysctl.h> 17#include <linux/sysctl.h>
18#include <linux/utsname.h> 18#include <linux/utsname.h>
19#include <trace/events/sched.h>
19 20
20/* 21/*
21 * The number of tasks checked: 22 * The number of tasks checked:
@@ -92,6 +93,9 @@ static void check_hung_task(struct task_struct *t, unsigned long timeout)
92 t->last_switch_count = switch_count; 93 t->last_switch_count = switch_count;
93 return; 94 return;
94 } 95 }
96
97 trace_sched_process_hang(t);
98
95 if (!sysctl_hung_task_warnings) 99 if (!sysctl_hung_task_warnings)
96 return; 100 return;
97 sysctl_hung_task_warnings--; 101 sysctl_hung_task_warnings--;