xref: /linux-6.15/include/trace/events/oom.h (revision d379f01d)
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 #endif
73 
74 /* This part must be outside protection */
75 #include <trace/define_trace.h>
76