aboutsummaryrefslogtreecommitdiffstats
path: root/include/trace
diff options
context:
space:
mode:
authorKAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>2012-01-10 18:08:09 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2012-01-10 19:30:44 -0500
commit43d2b113241d6797b890318767e0af78e313414b (patch)
tree6f25647f2660f8fca63cc8355b70ad643993dab8 /include/trace
parent6bd4837de96e7d9f9bf33e59117c24fc230862ac (diff)
tracepoint: add tracepoints for debugging oom_score_adj
oom_score_adj is used for guarding processes from OOM-Killer. One of problem is that it's inherited at fork(). When a daemon set oom_score_adj and make children, it's hard to know where the value is set. This patch adds some tracepoints useful for debugging. This patch adds 3 trace points. - creating new task - renaming a task (exec) - set oom_score_adj To debug, users need to enable some trace pointer. Maybe filtering is useful as # EVENT=/sys/kernel/debug/tracing/events/task/ # echo "oom_score_adj != 0" > $EVENT/task_newtask/filter # echo "oom_score_adj != 0" > $EVENT/task_rename/filter # echo 1 > $EVENT/enable # EVENT=/sys/kernel/debug/tracing/events/oom/ # echo 1 > $EVENT/enable output will be like this. # grep oom /sys/kernel/debug/tracing/trace bash-7699 [007] d..3 5140.744510: oom_score_adj_update: pid=7699 comm=bash oom_score_adj=-1000 bash-7699 [007] ...1 5151.818022: task_newtask: pid=7729 comm=bash clone_flags=1200011 oom_score_adj=-1000 ls-7729 [003] ...2 5151.818504: task_rename: pid=7729 oldcomm=bash newcomm=ls oom_score_adj=-1000 bash-7699 [002] ...1 5175.701468: task_newtask: pid=7730 comm=bash clone_flags=1200011 oom_score_adj=-1000 grep-7730 [007] ...2 5175.701993: task_rename: pid=7730 oldcomm=bash newcomm=grep oom_score_adj=-1000 Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com> Acked-by: David Rientjes <rientjes@google.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/trace')
-rw-r--r--include/trace/events/oom.h33
-rw-r--r--include/trace/events/task.h61
2 files changed, 94 insertions, 0 deletions
diff --git a/include/trace/events/oom.h b/include/trace/events/oom.h
new file mode 100644
index 000000000000..dd4ba3b92002
--- /dev/null
+++ b/include/trace/events/oom.h
@@ -0,0 +1,33 @@
1#undef TRACE_SYSTEM
2#define TRACE_SYSTEM oom
3
4#if !defined(_TRACE_OOM_H) || defined(TRACE_HEADER_MULTI_READ)
5#define _TRACE_OOM_H
6#include <linux/tracepoint.h>
7
8TRACE_EVENT(oom_score_adj_update,
9
10 TP_PROTO(struct task_struct *task),
11
12 TP_ARGS(task),
13
14 TP_STRUCT__entry(
15 __field( pid_t, pid)
16 __array( char, comm, TASK_COMM_LEN )
17 __field( int, oom_score_adj)
18 ),
19
20 TP_fast_assign(
21 __entry->pid = task->pid;
22 memcpy(__entry->comm, task->comm, TASK_COMM_LEN);
23 __entry->oom_score_adj = task->signal->oom_score_adj;
24 ),
25
26 TP_printk("pid=%d comm=%s oom_score_adj=%d",
27 __entry->pid, __entry->comm, __entry->oom_score_adj)
28);
29
30#endif
31
32/* This part must be outside protection */
33#include <trace/define_trace.h>
diff --git a/include/trace/events/task.h b/include/trace/events/task.h
new file mode 100644
index 000000000000..b53add02e929
--- /dev/null
+++ b/include/trace/events/task.h
@@ -0,0 +1,61 @@
1#undef TRACE_SYSTEM
2#define TRACE_SYSTEM task
3
4#if !defined(_TRACE_TASK_H) || defined(TRACE_HEADER_MULTI_READ)
5#define _TRACE_TASK_H
6#include <linux/tracepoint.h>
7
8TRACE_EVENT(task_newtask,
9
10 TP_PROTO(struct task_struct *task, unsigned long clone_flags),
11
12 TP_ARGS(task, clone_flags),
13
14 TP_STRUCT__entry(
15 __field( pid_t, pid)
16 __array( char, comm, TASK_COMM_LEN)
17 __field( unsigned long, clone_flags)
18 __field( int, oom_score_adj)
19 ),
20
21 TP_fast_assign(
22 __entry->pid = task->pid;
23 memcpy(__entry->comm, task->comm, TASK_COMM_LEN);
24 __entry->clone_flags = clone_flags;
25 __entry->oom_score_adj = task->signal->oom_score_adj;
26 ),
27
28 TP_printk("pid=%d comm=%s clone_flags=%lx oom_score_adj=%d",
29 __entry->pid, __entry->comm,
30 __entry->clone_flags, __entry->oom_score_adj)
31);
32
33TRACE_EVENT(task_rename,
34
35 TP_PROTO(struct task_struct *task, char *comm),
36
37 TP_ARGS(task, comm),
38
39 TP_STRUCT__entry(
40 __field( pid_t, pid)
41 __array( char, oldcomm, TASK_COMM_LEN)
42 __array( char, newcomm, TASK_COMM_LEN)
43 __field( int, oom_score_adj)
44 ),
45
46 TP_fast_assign(
47 __entry->pid = task->pid;
48 memcpy(entry->oldcomm, task->comm, TASK_COMM_LEN);
49 memcpy(entry->newcomm, comm, TASK_COMM_LEN);
50 __entry->oom_score_adj = task->signal->oom_score_adj;
51 ),
52
53 TP_printk("pid=%d oldcomm=%s newcomm=%s oom_score_adj=%d",
54 __entry->pid, __entry->oldcomm,
55 __entry->newcomm, __entry->oom_score_adj)
56);
57
58#endif
59
60/* This part must be outside protection */
61#include <trace/define_trace.h>