mm/oom_kill.c: add tracepoints for oom reaper-related events
[muen/linux.git] / include / trace / events / oom.h
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 #include <trace/events/mmflags.h>
8
9 TRACE_EVENT(oom_score_adj_update,
10
11         TP_PROTO(struct task_struct *task),
12
13         TP_ARGS(task),
14
15         TP_STRUCT__entry(
16                 __field(        pid_t,  pid)
17                 __array(        char,   comm,   TASK_COMM_LEN )
18                 __field(        short,  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->oom_score_adj = task->signal->oom_score_adj;
25         ),
26
27         TP_printk("pid=%d comm=%s oom_score_adj=%hd",
28                 __entry->pid, __entry->comm, __entry->oom_score_adj)
29 );
30
31 TRACE_EVENT(reclaim_retry_zone,
32
33         TP_PROTO(struct zoneref *zoneref,
34                 int order,
35                 unsigned long reclaimable,
36                 unsigned long available,
37                 unsigned long min_wmark,
38                 int no_progress_loops,
39                 bool wmark_check),
40
41         TP_ARGS(zoneref, order, reclaimable, available, min_wmark, no_progress_loops, wmark_check),
42
43         TP_STRUCT__entry(
44                 __field(        int, node)
45                 __field(        int, zone_idx)
46                 __field(        int,    order)
47                 __field(        unsigned long,  reclaimable)
48                 __field(        unsigned long,  available)
49                 __field(        unsigned long,  min_wmark)
50                 __field(        int,    no_progress_loops)
51                 __field(        bool,   wmark_check)
52         ),
53
54         TP_fast_assign(
55                 __entry->node = zone_to_nid(zoneref->zone);
56                 __entry->zone_idx = zoneref->zone_idx;
57                 __entry->order = order;
58                 __entry->reclaimable = reclaimable;
59                 __entry->available = available;
60                 __entry->min_wmark = min_wmark;
61                 __entry->no_progress_loops = no_progress_loops;
62                 __entry->wmark_check = wmark_check;
63         ),
64
65         TP_printk("node=%d zone=%-8s order=%d reclaimable=%lu available=%lu min_wmark=%lu no_progress_loops=%d wmark_check=%d",
66                         __entry->node, __print_symbolic(__entry->zone_idx, ZONE_TYPE),
67                         __entry->order,
68                         __entry->reclaimable, __entry->available, __entry->min_wmark,
69                         __entry->no_progress_loops,
70                         __entry->wmark_check)
71 );
72
73 TRACE_EVENT(mark_victim,
74         TP_PROTO(int pid),
75
76         TP_ARGS(pid),
77
78         TP_STRUCT__entry(
79                 __field(int, pid)
80         ),
81
82         TP_fast_assign(
83                 __entry->pid = pid;
84         ),
85
86         TP_printk("pid=%d", __entry->pid)
87 );
88
89 TRACE_EVENT(wake_reaper,
90         TP_PROTO(int pid),
91
92         TP_ARGS(pid),
93
94         TP_STRUCT__entry(
95                 __field(int, pid)
96         ),
97
98         TP_fast_assign(
99                 __entry->pid = pid;
100         ),
101
102         TP_printk("pid=%d", __entry->pid)
103 );
104
105 TRACE_EVENT(start_task_reaping,
106         TP_PROTO(int pid),
107
108         TP_ARGS(pid),
109
110         TP_STRUCT__entry(
111                 __field(int, pid)
112         ),
113
114         TP_fast_assign(
115                 __entry->pid = pid;
116         ),
117
118         TP_printk("pid=%d", __entry->pid)
119 );
120
121 TRACE_EVENT(finish_task_reaping,
122         TP_PROTO(int pid),
123
124         TP_ARGS(pid),
125
126         TP_STRUCT__entry(
127                 __field(int, pid)
128         ),
129
130         TP_fast_assign(
131                 __entry->pid = pid;
132         ),
133
134         TP_printk("pid=%d", __entry->pid)
135 );
136
137 TRACE_EVENT(skip_task_reaping,
138         TP_PROTO(int pid),
139
140         TP_ARGS(pid),
141
142         TP_STRUCT__entry(
143                 __field(int, pid)
144         ),
145
146         TP_fast_assign(
147                 __entry->pid = pid;
148         ),
149
150         TP_printk("pid=%d", __entry->pid)
151 );
152
153 #ifdef CONFIG_COMPACTION
154 TRACE_EVENT(compact_retry,
155
156         TP_PROTO(int order,
157                 enum compact_priority priority,
158                 enum compact_result result,
159                 int retries,
160                 int max_retries,
161                 bool ret),
162
163         TP_ARGS(order, priority, result, retries, max_retries, ret),
164
165         TP_STRUCT__entry(
166                 __field(        int, order)
167                 __field(        int, priority)
168                 __field(        int, result)
169                 __field(        int, retries)
170                 __field(        int, max_retries)
171                 __field(        bool, ret)
172         ),
173
174         TP_fast_assign(
175                 __entry->order = order;
176                 __entry->priority = priority;
177                 __entry->result = compact_result_to_feedback(result);
178                 __entry->retries = retries;
179                 __entry->max_retries = max_retries;
180                 __entry->ret = ret;
181         ),
182
183         TP_printk("order=%d priority=%s compaction_result=%s retries=%d max_retries=%d should_retry=%d",
184                         __entry->order,
185                         __print_symbolic(__entry->priority, COMPACTION_PRIORITY),
186                         __print_symbolic(__entry->result, COMPACTION_FEEDBACK),
187                         __entry->retries, __entry->max_retries,
188                         __entry->ret)
189 );
190 #endif /* CONFIG_COMPACTION */
191 #endif
192
193 /* This part must be outside protection */
194 #include <trace/define_trace.h>