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