1 /* SPDX-License-Identifier: GPL-2.0 */
3 #define TRACE_SYSTEM oom
5 #if !defined(_TRACE_OOM_H) || defined(TRACE_HEADER_MULTI_READ)
7 #include <linux/tracepoint.h>
8 #include <trace/events/mmflags.h>
10 #define PG_COUNT_TO_KB(x) ((x) << (PAGE_SHIFT - 10))
12 TRACE_EVENT(oom_score_adj_update
,
14 TP_PROTO(struct task_struct
*task
),
20 __array( char, comm
, TASK_COMM_LEN
)
21 __field( short, oom_score_adj
)
25 __entry
->pid
= task
->pid
;
26 memcpy(__entry
->comm
, task
->comm
, TASK_COMM_LEN
);
27 __entry
->oom_score_adj
= task
->signal
->oom_score_adj
;
30 TP_printk("pid=%d comm=%s oom_score_adj=%hd",
31 __entry
->pid
, __entry
->comm
, __entry
->oom_score_adj
)
34 TRACE_EVENT(reclaim_retry_zone
,
36 TP_PROTO(struct zoneref
*zoneref
,
38 unsigned long reclaimable
,
39 unsigned long available
,
40 unsigned long min_wmark
,
41 int no_progress_loops
,
44 TP_ARGS(zoneref
, order
, reclaimable
, available
, min_wmark
, no_progress_loops
, wmark_check
),
48 __field( int, zone_idx
)
50 __field( unsigned long, reclaimable
)
51 __field( unsigned long, available
)
52 __field( unsigned long, min_wmark
)
53 __field( int, no_progress_loops
)
54 __field( bool, wmark_check
)
58 __entry
->node
= zonelist_node_idx(zoneref
);
59 __entry
->zone_idx
= zonelist_zone_idx(zoneref
);
60 __entry
->order
= order
;
61 __entry
->reclaimable
= reclaimable
;
62 __entry
->available
= available
;
63 __entry
->min_wmark
= min_wmark
;
64 __entry
->no_progress_loops
= no_progress_loops
;
65 __entry
->wmark_check
= wmark_check
;
68 TP_printk("node=%d zone=%-8s order=%d reclaimable=%lu available=%lu min_wmark=%lu no_progress_loops=%d wmark_check=%d",
69 __entry
->node
, __print_symbolic(__entry
->zone_idx
, ZONE_TYPE
),
71 __entry
->reclaimable
, __entry
->available
, __entry
->min_wmark
,
72 __entry
->no_progress_loops
,
76 TRACE_EVENT(mark_victim
,
77 TP_PROTO(struct task_struct
*task
, uid_t uid
),
83 __string(comm
, task
->comm
)
84 __field(unsigned long, total_vm
)
85 __field(unsigned long, anon_rss
)
86 __field(unsigned long, file_rss
)
87 __field(unsigned long, shmem_rss
)
89 __field(unsigned long, pgtables
)
90 __field(short, oom_score_adj
)
94 __entry
->pid
= task
->pid
;
96 __entry
->total_vm
= PG_COUNT_TO_KB(task
->mm
->total_vm
);
97 __entry
->anon_rss
= PG_COUNT_TO_KB(get_mm_counter(task
->mm
, MM_ANONPAGES
));
98 __entry
->file_rss
= PG_COUNT_TO_KB(get_mm_counter(task
->mm
, MM_FILEPAGES
));
99 __entry
->shmem_rss
= PG_COUNT_TO_KB(get_mm_counter(task
->mm
, MM_SHMEMPAGES
));
101 __entry
->pgtables
= mm_pgtables_bytes(task
->mm
) >> 10;
102 __entry
->oom_score_adj
= task
->signal
->oom_score_adj
;
105 TP_printk("pid=%d comm=%s total-vm=%lukB anon-rss=%lukB file-rss:%lukB shmem-rss:%lukB uid=%u pgtables=%lukB oom_score_adj=%hd",
114 __entry
->oom_score_adj
118 TRACE_EVENT(wake_reaper
,
131 TP_printk("pid=%d", __entry
->pid
)
134 TRACE_EVENT(start_task_reaping
,
147 TP_printk("pid=%d", __entry
->pid
)
150 TRACE_EVENT(finish_task_reaping
,
163 TP_printk("pid=%d", __entry
->pid
)
166 TRACE_EVENT(skip_task_reaping
,
179 TP_printk("pid=%d", __entry
->pid
)
182 #ifdef CONFIG_COMPACTION
183 TRACE_EVENT(compact_retry
,
186 enum compact_priority priority
,
187 enum compact_result result
,
192 TP_ARGS(order
, priority
, result
, retries
, max_retries
, ret
),
196 __field( int, priority
)
197 __field( int, result
)
198 __field( int, retries
)
199 __field( int, max_retries
)
204 __entry
->order
= order
;
205 __entry
->priority
= priority
;
206 __entry
->result
= compact_result_to_feedback(result
);
207 __entry
->retries
= retries
;
208 __entry
->max_retries
= max_retries
;
212 TP_printk("order=%d priority=%s compaction_result=%s retries=%d max_retries=%d should_retry=%d",
214 __print_symbolic(__entry
->priority
, COMPACTION_PRIORITY
),
215 __print_symbolic(__entry
->result
, COMPACTION_FEEDBACK
),
216 __entry
->retries
, __entry
->max_retries
,
219 #endif /* CONFIG_COMPACTION */
222 /* This part must be outside protection */
223 #include <trace/define_trace.h>