Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
torvalds
GitHub Repository: torvalds/linux
Path: blob/master/include/trace/events/compaction.h
26282 views
1
/* SPDX-License-Identifier: GPL-2.0 */
2
#undef TRACE_SYSTEM
3
#define TRACE_SYSTEM compaction
4
5
#if !defined(_TRACE_COMPACTION_H) || defined(TRACE_HEADER_MULTI_READ)
6
#define _TRACE_COMPACTION_H
7
8
#include <linux/types.h>
9
#include <linux/list.h>
10
#include <linux/tracepoint.h>
11
#include <trace/events/mmflags.h>
12
13
14
DECLARE_EVENT_CLASS(mm_compaction_isolate_template,
15
16
TP_PROTO(
17
unsigned long start_pfn,
18
unsigned long end_pfn,
19
unsigned long nr_scanned,
20
unsigned long nr_taken),
21
22
TP_ARGS(start_pfn, end_pfn, nr_scanned, nr_taken),
23
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)
29
),
30
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;
36
),
37
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)
43
);
44
45
DEFINE_EVENT(mm_compaction_isolate_template, mm_compaction_isolate_migratepages,
46
47
TP_PROTO(
48
unsigned long start_pfn,
49
unsigned long end_pfn,
50
unsigned long nr_scanned,
51
unsigned long nr_taken),
52
53
TP_ARGS(start_pfn, end_pfn, nr_scanned, nr_taken)
54
);
55
56
DEFINE_EVENT(mm_compaction_isolate_template, mm_compaction_isolate_freepages,
57
58
TP_PROTO(
59
unsigned long start_pfn,
60
unsigned long end_pfn,
61
unsigned long nr_scanned,
62
unsigned long nr_taken),
63
64
TP_ARGS(start_pfn, end_pfn, nr_scanned, nr_taken)
65
);
66
67
DEFINE_EVENT(mm_compaction_isolate_template, mm_compaction_fast_isolate_freepages,
68
69
TP_PROTO(
70
unsigned long start_pfn,
71
unsigned long end_pfn,
72
unsigned long nr_scanned,
73
unsigned long nr_taken),
74
75
TP_ARGS(start_pfn, end_pfn, nr_scanned, nr_taken)
76
);
77
78
#ifdef CONFIG_COMPACTION
79
TRACE_EVENT(mm_compaction_migratepages,
80
81
TP_PROTO(unsigned int nr_migratepages,
82
unsigned int nr_succeeded),
83
84
TP_ARGS(nr_migratepages, nr_succeeded),
85
86
TP_STRUCT__entry(
87
__field(unsigned long, nr_migrated)
88
__field(unsigned long, nr_failed)
89
),
90
91
TP_fast_assign(
92
__entry->nr_migrated = nr_succeeded;
93
__entry->nr_failed = nr_migratepages - nr_succeeded;
94
),
95
96
TP_printk("nr_migrated=%lu nr_failed=%lu",
97
__entry->nr_migrated,
98
__entry->nr_failed)
99
);
100
101
TRACE_EVENT(mm_compaction_begin,
102
TP_PROTO(struct compact_control *cc, unsigned long zone_start,
103
unsigned long zone_end, bool sync),
104
105
TP_ARGS(cc, zone_start, zone_end, sync),
106
107
TP_STRUCT__entry(
108
__field(unsigned long, zone_start)
109
__field(unsigned long, migrate_pfn)
110
__field(unsigned long, free_pfn)
111
__field(unsigned long, zone_end)
112
__field(bool, sync)
113
),
114
115
TP_fast_assign(
116
__entry->zone_start = zone_start;
117
__entry->migrate_pfn = cc->migrate_pfn;
118
__entry->free_pfn = cc->free_pfn;
119
__entry->zone_end = zone_end;
120
__entry->sync = sync;
121
),
122
123
TP_printk("zone_start=0x%lx migrate_pfn=0x%lx free_pfn=0x%lx zone_end=0x%lx, mode=%s",
124
__entry->zone_start,
125
__entry->migrate_pfn,
126
__entry->free_pfn,
127
__entry->zone_end,
128
__entry->sync ? "sync" : "async")
129
);
130
131
TRACE_EVENT(mm_compaction_end,
132
TP_PROTO(struct compact_control *cc, unsigned long zone_start,
133
unsigned long zone_end, bool sync,
134
int status),
135
136
TP_ARGS(cc, zone_start, zone_end, sync, status),
137
138
TP_STRUCT__entry(
139
__field(unsigned long, zone_start)
140
__field(unsigned long, migrate_pfn)
141
__field(unsigned long, free_pfn)
142
__field(unsigned long, zone_end)
143
__field(bool, sync)
144
__field(int, status)
145
),
146
147
TP_fast_assign(
148
__entry->zone_start = zone_start;
149
__entry->migrate_pfn = cc->migrate_pfn;
150
__entry->free_pfn = cc->free_pfn;
151
__entry->zone_end = zone_end;
152
__entry->sync = sync;
153
__entry->status = status;
154
),
155
156
TP_printk("zone_start=0x%lx migrate_pfn=0x%lx free_pfn=0x%lx zone_end=0x%lx, mode=%s status=%s",
157
__entry->zone_start,
158
__entry->migrate_pfn,
159
__entry->free_pfn,
160
__entry->zone_end,
161
__entry->sync ? "sync" : "async",
162
__print_symbolic(__entry->status, COMPACTION_STATUS))
163
);
164
165
TRACE_EVENT(mm_compaction_try_to_compact_pages,
166
167
TP_PROTO(
168
int order,
169
gfp_t gfp_mask,
170
int prio),
171
172
TP_ARGS(order, gfp_mask, prio),
173
174
TP_STRUCT__entry(
175
__field(int, order)
176
__field(unsigned long, gfp_mask)
177
__field(int, prio)
178
),
179
180
TP_fast_assign(
181
__entry->order = order;
182
__entry->gfp_mask = (__force unsigned long)gfp_mask;
183
__entry->prio = prio;
184
),
185
186
TP_printk("order=%d gfp_mask=%s priority=%d",
187
__entry->order,
188
show_gfp_flags(__entry->gfp_mask),
189
__entry->prio)
190
);
191
192
DECLARE_EVENT_CLASS(mm_compaction_suitable_template,
193
194
TP_PROTO(struct zone *zone,
195
int order,
196
int ret),
197
198
TP_ARGS(zone, order, ret),
199
200
TP_STRUCT__entry(
201
__field(int, nid)
202
__field(enum zone_type, idx)
203
__field(int, order)
204
__field(int, ret)
205
),
206
207
TP_fast_assign(
208
__entry->nid = zone_to_nid(zone);
209
__entry->idx = zone_idx(zone);
210
__entry->order = order;
211
__entry->ret = ret;
212
),
213
214
TP_printk("node=%d zone=%-8s order=%d ret=%s",
215
__entry->nid,
216
__print_symbolic(__entry->idx, ZONE_TYPE),
217
__entry->order,
218
__print_symbolic(__entry->ret, COMPACTION_STATUS))
219
);
220
221
DEFINE_EVENT(mm_compaction_suitable_template, mm_compaction_finished,
222
223
TP_PROTO(struct zone *zone,
224
int order,
225
int ret),
226
227
TP_ARGS(zone, order, ret)
228
);
229
230
DEFINE_EVENT(mm_compaction_suitable_template, mm_compaction_suitable,
231
232
TP_PROTO(struct zone *zone,
233
int order,
234
int ret),
235
236
TP_ARGS(zone, order, ret)
237
);
238
239
DECLARE_EVENT_CLASS(mm_compaction_defer_template,
240
241
TP_PROTO(struct zone *zone, int order),
242
243
TP_ARGS(zone, order),
244
245
TP_STRUCT__entry(
246
__field(int, nid)
247
__field(enum zone_type, idx)
248
__field(int, order)
249
__field(unsigned int, considered)
250
__field(unsigned int, defer_shift)
251
__field(int, order_failed)
252
),
253
254
TP_fast_assign(
255
__entry->nid = zone_to_nid(zone);
256
__entry->idx = zone_idx(zone);
257
__entry->order = order;
258
__entry->considered = zone->compact_considered;
259
__entry->defer_shift = zone->compact_defer_shift;
260
__entry->order_failed = zone->compact_order_failed;
261
),
262
263
TP_printk("node=%d zone=%-8s order=%d order_failed=%d consider=%u limit=%lu",
264
__entry->nid,
265
__print_symbolic(__entry->idx, ZONE_TYPE),
266
__entry->order,
267
__entry->order_failed,
268
__entry->considered,
269
1UL << __entry->defer_shift)
270
);
271
272
DEFINE_EVENT(mm_compaction_defer_template, mm_compaction_deferred,
273
274
TP_PROTO(struct zone *zone, int order),
275
276
TP_ARGS(zone, order)
277
);
278
279
DEFINE_EVENT(mm_compaction_defer_template, mm_compaction_defer_compaction,
280
281
TP_PROTO(struct zone *zone, int order),
282
283
TP_ARGS(zone, order)
284
);
285
286
DEFINE_EVENT(mm_compaction_defer_template, mm_compaction_defer_reset,
287
288
TP_PROTO(struct zone *zone, int order),
289
290
TP_ARGS(zone, order)
291
);
292
293
TRACE_EVENT(mm_compaction_kcompactd_sleep,
294
295
TP_PROTO(int nid),
296
297
TP_ARGS(nid),
298
299
TP_STRUCT__entry(
300
__field(int, nid)
301
),
302
303
TP_fast_assign(
304
__entry->nid = nid;
305
),
306
307
TP_printk("nid=%d", __entry->nid)
308
);
309
310
DECLARE_EVENT_CLASS(kcompactd_wake_template,
311
312
TP_PROTO(int nid, int order, enum zone_type highest_zoneidx),
313
314
TP_ARGS(nid, order, highest_zoneidx),
315
316
TP_STRUCT__entry(
317
__field(int, nid)
318
__field(int, order)
319
__field(enum zone_type, highest_zoneidx)
320
),
321
322
TP_fast_assign(
323
__entry->nid = nid;
324
__entry->order = order;
325
__entry->highest_zoneidx = highest_zoneidx;
326
),
327
328
/*
329
* classzone_idx is previous name of the highest_zoneidx.
330
* Reason not to change it is the ABI requirement of the tracepoint.
331
*/
332
TP_printk("nid=%d order=%d classzone_idx=%-8s",
333
__entry->nid,
334
__entry->order,
335
__print_symbolic(__entry->highest_zoneidx, ZONE_TYPE))
336
);
337
338
DEFINE_EVENT(kcompactd_wake_template, mm_compaction_wakeup_kcompactd,
339
340
TP_PROTO(int nid, int order, enum zone_type highest_zoneidx),
341
342
TP_ARGS(nid, order, highest_zoneidx)
343
);
344
345
DEFINE_EVENT(kcompactd_wake_template, mm_compaction_kcompactd_wake,
346
347
TP_PROTO(int nid, int order, enum zone_type highest_zoneidx),
348
349
TP_ARGS(nid, order, highest_zoneidx)
350
);
351
#endif
352
353
#endif /* _TRACE_COMPACTION_H */
354
355
/* This part must be outside protection */
356
#include <trace/define_trace.h>
357
358