oom.h 3.9 KB

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