Merge tag 'iommu-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux
[linux/fpc-iii.git] / include / trace / events / compaction.h
blob54e5bf081171f5978efceb18cc4b80cc56a2e0a4
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #undef TRACE_SYSTEM
3 #define TRACE_SYSTEM compaction
5 #if !defined(_TRACE_COMPACTION_H) || defined(TRACE_HEADER_MULTI_READ)
6 #define _TRACE_COMPACTION_H
8 #include <linux/types.h>
9 #include <linux/list.h>
10 #include <linux/tracepoint.h>
11 #include <trace/events/mmflags.h>
14 DECLARE_EVENT_CLASS(mm_compaction_isolate_template,
16 TP_PROTO(
17 unsigned long start_pfn,
18 unsigned long end_pfn,
19 unsigned long nr_scanned,
20 unsigned long nr_taken),
22 TP_ARGS(start_pfn, end_pfn, nr_scanned, nr_taken),
24 TP_STRUCT__entry(
25 __field(unsigned long, start_pfn)
26 __field(unsigned long, end_pfn)
27 __field(unsigned long, nr_scanned)
28 __field(unsigned long, nr_taken)
31 TP_fast_assign(
32 __entry->start_pfn = start_pfn;
33 __entry->end_pfn = end_pfn;
34 __entry->nr_scanned = nr_scanned;
35 __entry->nr_taken = nr_taken;
38 TP_printk("range=(0x%lx ~ 0x%lx) nr_scanned=%lu nr_taken=%lu",
39 __entry->start_pfn,
40 __entry->end_pfn,
41 __entry->nr_scanned,
42 __entry->nr_taken)
45 DEFINE_EVENT(mm_compaction_isolate_template, mm_compaction_isolate_migratepages,
47 TP_PROTO(
48 unsigned long start_pfn,
49 unsigned long end_pfn,
50 unsigned long nr_scanned,
51 unsigned long nr_taken),
53 TP_ARGS(start_pfn, end_pfn, nr_scanned, nr_taken)
56 DEFINE_EVENT(mm_compaction_isolate_template, mm_compaction_isolate_freepages,
58 TP_PROTO(
59 unsigned long start_pfn,
60 unsigned long end_pfn,
61 unsigned long nr_scanned,
62 unsigned long nr_taken),
64 TP_ARGS(start_pfn, end_pfn, nr_scanned, nr_taken)
67 #ifdef CONFIG_COMPACTION
68 TRACE_EVENT(mm_compaction_migratepages,
70 TP_PROTO(unsigned long nr_all,
71 int migrate_rc,
72 struct list_head *migratepages),
74 TP_ARGS(nr_all, migrate_rc, migratepages),
76 TP_STRUCT__entry(
77 __field(unsigned long, nr_migrated)
78 __field(unsigned long, nr_failed)
81 TP_fast_assign(
82 unsigned long nr_failed = 0;
83 struct list_head *page_lru;
86 * migrate_pages() returns either a non-negative number
87 * with the number of pages that failed migration, or an
88 * error code, in which case we need to count the remaining
89 * pages manually
91 if (migrate_rc >= 0)
92 nr_failed = migrate_rc;
93 else
94 list_for_each(page_lru, migratepages)
95 nr_failed++;
97 __entry->nr_migrated = nr_all - nr_failed;
98 __entry->nr_failed = nr_failed;
101 TP_printk("nr_migrated=%lu nr_failed=%lu",
102 __entry->nr_migrated,
103 __entry->nr_failed)
106 TRACE_EVENT(mm_compaction_begin,
107 TP_PROTO(unsigned long zone_start, unsigned long migrate_pfn,
108 unsigned long free_pfn, unsigned long zone_end, bool sync),
110 TP_ARGS(zone_start, migrate_pfn, free_pfn, zone_end, sync),
112 TP_STRUCT__entry(
113 __field(unsigned long, zone_start)
114 __field(unsigned long, migrate_pfn)
115 __field(unsigned long, free_pfn)
116 __field(unsigned long, zone_end)
117 __field(bool, sync)
120 TP_fast_assign(
121 __entry->zone_start = zone_start;
122 __entry->migrate_pfn = migrate_pfn;
123 __entry->free_pfn = free_pfn;
124 __entry->zone_end = zone_end;
125 __entry->sync = sync;
128 TP_printk("zone_start=0x%lx migrate_pfn=0x%lx free_pfn=0x%lx zone_end=0x%lx, mode=%s",
129 __entry->zone_start,
130 __entry->migrate_pfn,
131 __entry->free_pfn,
132 __entry->zone_end,
133 __entry->sync ? "sync" : "async")
136 TRACE_EVENT(mm_compaction_end,
137 TP_PROTO(unsigned long zone_start, unsigned long migrate_pfn,
138 unsigned long free_pfn, unsigned long zone_end, bool sync,
139 int status),
141 TP_ARGS(zone_start, migrate_pfn, free_pfn, zone_end, sync, status),
143 TP_STRUCT__entry(
144 __field(unsigned long, zone_start)
145 __field(unsigned long, migrate_pfn)
146 __field(unsigned long, free_pfn)
147 __field(unsigned long, zone_end)
148 __field(bool, sync)
149 __field(int, status)
152 TP_fast_assign(
153 __entry->zone_start = zone_start;
154 __entry->migrate_pfn = migrate_pfn;
155 __entry->free_pfn = free_pfn;
156 __entry->zone_end = zone_end;
157 __entry->sync = sync;
158 __entry->status = status;
161 TP_printk("zone_start=0x%lx migrate_pfn=0x%lx free_pfn=0x%lx zone_end=0x%lx, mode=%s status=%s",
162 __entry->zone_start,
163 __entry->migrate_pfn,
164 __entry->free_pfn,
165 __entry->zone_end,
166 __entry->sync ? "sync" : "async",
167 __print_symbolic(__entry->status, COMPACTION_STATUS))
170 TRACE_EVENT(mm_compaction_try_to_compact_pages,
172 TP_PROTO(
173 int order,
174 gfp_t gfp_mask,
175 int prio),
177 TP_ARGS(order, gfp_mask, prio),
179 TP_STRUCT__entry(
180 __field(int, order)
181 __field(gfp_t, gfp_mask)
182 __field(int, prio)
185 TP_fast_assign(
186 __entry->order = order;
187 __entry->gfp_mask = gfp_mask;
188 __entry->prio = prio;
191 TP_printk("order=%d gfp_mask=%s priority=%d",
192 __entry->order,
193 show_gfp_flags(__entry->gfp_mask),
194 __entry->prio)
197 DECLARE_EVENT_CLASS(mm_compaction_suitable_template,
199 TP_PROTO(struct zone *zone,
200 int order,
201 int ret),
203 TP_ARGS(zone, order, ret),
205 TP_STRUCT__entry(
206 __field(int, nid)
207 __field(enum zone_type, idx)
208 __field(int, order)
209 __field(int, ret)
212 TP_fast_assign(
213 __entry->nid = zone_to_nid(zone);
214 __entry->idx = zone_idx(zone);
215 __entry->order = order;
216 __entry->ret = ret;
219 TP_printk("node=%d zone=%-8s order=%d ret=%s",
220 __entry->nid,
221 __print_symbolic(__entry->idx, ZONE_TYPE),
222 __entry->order,
223 __print_symbolic(__entry->ret, COMPACTION_STATUS))
226 DEFINE_EVENT(mm_compaction_suitable_template, mm_compaction_finished,
228 TP_PROTO(struct zone *zone,
229 int order,
230 int ret),
232 TP_ARGS(zone, order, ret)
235 DEFINE_EVENT(mm_compaction_suitable_template, mm_compaction_suitable,
237 TP_PROTO(struct zone *zone,
238 int order,
239 int ret),
241 TP_ARGS(zone, order, ret)
244 DECLARE_EVENT_CLASS(mm_compaction_defer_template,
246 TP_PROTO(struct zone *zone, int order),
248 TP_ARGS(zone, order),
250 TP_STRUCT__entry(
251 __field(int, nid)
252 __field(enum zone_type, idx)
253 __field(int, order)
254 __field(unsigned int, considered)
255 __field(unsigned int, defer_shift)
256 __field(int, order_failed)
259 TP_fast_assign(
260 __entry->nid = zone_to_nid(zone);
261 __entry->idx = zone_idx(zone);
262 __entry->order = order;
263 __entry->considered = zone->compact_considered;
264 __entry->defer_shift = zone->compact_defer_shift;
265 __entry->order_failed = zone->compact_order_failed;
268 TP_printk("node=%d zone=%-8s order=%d order_failed=%d consider=%u limit=%lu",
269 __entry->nid,
270 __print_symbolic(__entry->idx, ZONE_TYPE),
271 __entry->order,
272 __entry->order_failed,
273 __entry->considered,
274 1UL << __entry->defer_shift)
277 DEFINE_EVENT(mm_compaction_defer_template, mm_compaction_deferred,
279 TP_PROTO(struct zone *zone, int order),
281 TP_ARGS(zone, order)
284 DEFINE_EVENT(mm_compaction_defer_template, mm_compaction_defer_compaction,
286 TP_PROTO(struct zone *zone, int order),
288 TP_ARGS(zone, order)
291 DEFINE_EVENT(mm_compaction_defer_template, mm_compaction_defer_reset,
293 TP_PROTO(struct zone *zone, int order),
295 TP_ARGS(zone, order)
298 TRACE_EVENT(mm_compaction_kcompactd_sleep,
300 TP_PROTO(int nid),
302 TP_ARGS(nid),
304 TP_STRUCT__entry(
305 __field(int, nid)
308 TP_fast_assign(
309 __entry->nid = nid;
312 TP_printk("nid=%d", __entry->nid)
315 DECLARE_EVENT_CLASS(kcompactd_wake_template,
317 TP_PROTO(int nid, int order, enum zone_type highest_zoneidx),
319 TP_ARGS(nid, order, highest_zoneidx),
321 TP_STRUCT__entry(
322 __field(int, nid)
323 __field(int, order)
324 __field(enum zone_type, highest_zoneidx)
327 TP_fast_assign(
328 __entry->nid = nid;
329 __entry->order = order;
330 __entry->highest_zoneidx = highest_zoneidx;
334 * classzone_idx is previous name of the highest_zoneidx.
335 * Reason not to change it is the ABI requirement of the tracepoint.
337 TP_printk("nid=%d order=%d classzone_idx=%-8s",
338 __entry->nid,
339 __entry->order,
340 __print_symbolic(__entry->highest_zoneidx, ZONE_TYPE))
343 DEFINE_EVENT(kcompactd_wake_template, mm_compaction_wakeup_kcompactd,
345 TP_PROTO(int nid, int order, enum zone_type highest_zoneidx),
347 TP_ARGS(nid, order, highest_zoneidx)
350 DEFINE_EVENT(kcompactd_wake_template, mm_compaction_kcompactd_wake,
352 TP_PROTO(int nid, int order, enum zone_type highest_zoneidx),
354 TP_ARGS(nid, order, highest_zoneidx)
356 #endif
358 #endif /* _TRACE_COMPACTION_H */
360 /* This part must be outside protection */
361 #include <trace/define_trace.h>