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