xref: /linux/include/trace/events/oom.h (revision e58e871becec2d3b04ed91c0c16fe8deac9c9dfa)
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 #ifdef CONFIG_COMPACTION
74 TRACE_EVENT(compact_retry,
75 
76 	TP_PROTO(int order,
77 		enum compact_priority priority,
78 		enum compact_result result,
79 		int retries,
80 		int max_retries,
81 		bool ret),
82 
83 	TP_ARGS(order, priority, result, retries, max_retries, ret),
84 
85 	TP_STRUCT__entry(
86 		__field(	int, order)
87 		__field(	int, priority)
88 		__field(	int, result)
89 		__field(	int, retries)
90 		__field(	int, max_retries)
91 		__field(	bool, ret)
92 	),
93 
94 	TP_fast_assign(
95 		__entry->order = order;
96 		__entry->priority = priority;
97 		__entry->result = compact_result_to_feedback(result);
98 		__entry->retries = retries;
99 		__entry->max_retries = max_retries;
100 		__entry->ret = ret;
101 	),
102 
103 	TP_printk("order=%d priority=%s compaction_result=%s retries=%d max_retries=%d should_retry=%d",
104 			__entry->order,
105 			__print_symbolic(__entry->priority, COMPACTION_PRIORITY),
106 			__print_symbolic(__entry->result, COMPACTION_FEEDBACK),
107 			__entry->retries, __entry->max_retries,
108 			__entry->ret)
109 );
110 #endif /* CONFIG_COMPACTION */
111 #endif
112 
113 /* This part must be outside protection */
114 #include <trace/define_trace.h>
115