Fix: format address fields as hexadecimal
[lttng-modules.git] / instrumentation / events / lttng-module / mm_vmscan.h
1 #undef TRACE_SYSTEM
2 #define TRACE_SYSTEM mm_vmscan
3
4 #if !defined(LTTNG_TRACE_MM_VMSCAN_H) || defined(TRACE_HEADER_MULTI_READ)
5 #define LTTNG_TRACE_MM_VMSCAN_H
6
7 #include "../../../probes/lttng-tracepoint-event.h"
8 #include <linux/types.h>
9 #include <linux/mm.h>
10 #include <linux/memcontrol.h>
11 #include <trace/events/gfpflags.h>
12 #include <linux/version.h>
13
14 #ifndef _TRACE_VMSCAN_DEF
15 #define _TRACE_VMSCAN_DEF
16 #define RECLAIM_WB_ANON 0x0001u
17 #define RECLAIM_WB_FILE 0x0002u
18 #define RECLAIM_WB_MIXED 0x0010u
19 #define RECLAIM_WB_SYNC 0x0004u /* Unused, all reclaim async */
20 #define RECLAIM_WB_ASYNC 0x0008u
21
22 #if ((LINUX_VERSION_CODE <= KERNEL_VERSION(3,0,38)) || \
23 LTTNG_KERNEL_RANGE(3,1,0, 3,2,0))
24 typedef int isolate_mode_t;
25 #endif
26
27 #endif
28
29 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,5,0))
30
31 #include <linux/mm_inline.h>
32
33 #define trace_reclaim_flags(page) ( \
34 (page_is_file_cache(page) ? RECLAIM_WB_FILE : RECLAIM_WB_ANON) | \
35 (RECLAIM_WB_ASYNC) \
36 )
37
38 #define trace_shrink_flags(file) \
39 ( \
40 (file ? RECLAIM_WB_FILE : RECLAIM_WB_ANON) | \
41 (RECLAIM_WB_ASYNC) \
42 )
43
44 #endif
45
46 LTTNG_TRACEPOINT_EVENT(mm_vmscan_kswapd_sleep,
47
48 TP_PROTO(int nid),
49
50 TP_ARGS(nid),
51
52 TP_FIELDS(
53 ctf_integer(int, nid, nid)
54 )
55 )
56
57 LTTNG_TRACEPOINT_EVENT(mm_vmscan_kswapd_wake,
58
59 TP_PROTO(int nid, int order),
60
61 TP_ARGS(nid, order),
62
63 TP_FIELDS(
64 ctf_integer(int, nid, nid)
65 ctf_integer(int, order, order)
66 )
67 )
68
69 LTTNG_TRACEPOINT_EVENT(mm_vmscan_wakeup_kswapd,
70
71 TP_PROTO(int nid, int zid, int order),
72
73 TP_ARGS(nid, zid, order),
74
75 TP_FIELDS(
76 ctf_integer(int, nid, nid)
77 ctf_integer(int, zid, zid)
78 ctf_integer(int, order, order)
79 )
80 )
81
82 LTTNG_TRACEPOINT_EVENT_CLASS(mm_vmscan_direct_reclaim_begin_template,
83
84 TP_PROTO(int order, int may_writepage, gfp_t gfp_flags),
85
86 TP_ARGS(order, may_writepage, gfp_flags),
87
88 TP_FIELDS(
89 ctf_integer(int, order, order)
90 ctf_integer(int, may_writepage, may_writepage)
91 ctf_integer(gfp_t, gfp_flags, gfp_flags)
92 )
93 )
94
95 LTTNG_TRACEPOINT_EVENT_INSTANCE(mm_vmscan_direct_reclaim_begin_template, mm_vmscan_direct_reclaim_begin,
96
97 TP_PROTO(int order, int may_writepage, gfp_t gfp_flags),
98
99 TP_ARGS(order, may_writepage, gfp_flags)
100 )
101
102 LTTNG_TRACEPOINT_EVENT_INSTANCE(mm_vmscan_direct_reclaim_begin_template, mm_vmscan_memcg_reclaim_begin,
103
104 TP_PROTO(int order, int may_writepage, gfp_t gfp_flags),
105
106 TP_ARGS(order, may_writepage, gfp_flags)
107 )
108
109 LTTNG_TRACEPOINT_EVENT_INSTANCE(mm_vmscan_direct_reclaim_begin_template, mm_vmscan_memcg_softlimit_reclaim_begin,
110
111 TP_PROTO(int order, int may_writepage, gfp_t gfp_flags),
112
113 TP_ARGS(order, may_writepage, gfp_flags)
114 )
115
116 LTTNG_TRACEPOINT_EVENT_CLASS(mm_vmscan_direct_reclaim_end_template,
117
118 TP_PROTO(unsigned long nr_reclaimed),
119
120 TP_ARGS(nr_reclaimed),
121
122 TP_FIELDS(
123 ctf_integer(unsigned long, nr_reclaimed, nr_reclaimed)
124 )
125 )
126
127 LTTNG_TRACEPOINT_EVENT_INSTANCE(mm_vmscan_direct_reclaim_end_template, mm_vmscan_direct_reclaim_end,
128
129 TP_PROTO(unsigned long nr_reclaimed),
130
131 TP_ARGS(nr_reclaimed)
132 )
133
134 LTTNG_TRACEPOINT_EVENT_INSTANCE(mm_vmscan_direct_reclaim_end_template, mm_vmscan_memcg_reclaim_end,
135
136 TP_PROTO(unsigned long nr_reclaimed),
137
138 TP_ARGS(nr_reclaimed)
139 )
140
141 LTTNG_TRACEPOINT_EVENT_INSTANCE(mm_vmscan_direct_reclaim_end_template, mm_vmscan_memcg_softlimit_reclaim_end,
142
143 TP_PROTO(unsigned long nr_reclaimed),
144
145 TP_ARGS(nr_reclaimed)
146 )
147
148 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0))
149 LTTNG_TRACEPOINT_EVENT_MAP(mm_shrink_slab_start,
150
151 mm_vmscan_shrink_slab_start,
152
153 TP_PROTO(struct shrinker *shr, struct shrink_control *sc,
154 long nr_objects_to_shrink, unsigned long pgs_scanned,
155 unsigned long lru_pgs, unsigned long cache_items,
156 unsigned long long delta, unsigned long total_scan),
157
158 TP_ARGS(shr, sc, nr_objects_to_shrink, pgs_scanned, lru_pgs,
159 cache_items, delta, total_scan),
160
161 TP_FIELDS(
162 ctf_integer_hex(struct shrinker *, shr, shr)
163 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0))
164 ctf_integer_hex(void *, shrink, shr->scan_objects)
165 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0)) */
166 ctf_integer_hex(void *, shrink, shr->shrink)
167 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0)) */
168 ctf_integer(long, nr_objects_to_shrink, nr_objects_to_shrink)
169 ctf_integer(gfp_t, gfp_flags, sc->gfp_mask)
170 ctf_integer(unsigned long, pgs_scanned, pgs_scanned)
171 ctf_integer(unsigned long, lru_pgs, lru_pgs)
172 ctf_integer(unsigned long, cache_items, cache_items)
173 ctf_integer(unsigned long long, delta, delta)
174 ctf_integer(unsigned long, total_scan, total_scan)
175 )
176 )
177
178 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,16,0))
179 LTTNG_TRACEPOINT_EVENT_MAP(mm_shrink_slab_end,
180
181 mm_vmscan_shrink_slab_end,
182
183 TP_PROTO(struct shrinker *shr, int nid, int shrinker_retval,
184 long unused_scan_cnt, long new_scan_cnt, long total_scan),
185
186 TP_ARGS(shr, nid, shrinker_retval, unused_scan_cnt, new_scan_cnt,
187 total_scan),
188
189 TP_FIELDS(
190 ctf_integer_hex(struct shrinker *, shr, shr)
191 ctf_integer(int, nid, nid)
192 ctf_integer_hex(void *, shrink, shr->scan_objects)
193 ctf_integer(long, unused_scan, unused_scan_cnt)
194 ctf_integer(long, new_scan, new_scan_cnt)
195 ctf_integer(int, retval, shrinker_retval)
196 ctf_integer(long, total_scan, total_scan)
197 )
198 )
199 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,16,0)) */
200 LTTNG_TRACEPOINT_EVENT_MAP(mm_shrink_slab_end,
201
202 mm_vmscan_shrink_slab_end,
203
204 TP_PROTO(struct shrinker *shr, int shrinker_retval,
205 long unused_scan_cnt, long new_scan_cnt),
206
207 TP_ARGS(shr, shrinker_retval, unused_scan_cnt, new_scan_cnt),
208
209 TP_FIELDS(
210 ctf_integer_hex(struct shrinker *, shr, shr)
211 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0))
212 ctf_integer_hex(void *, shrink, shr->scan_objects)
213 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0)) */
214 ctf_integer_hex(void *, shrink, shr->shrink)
215 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0)) */
216 ctf_integer(long, unused_scan, unused_scan_cnt)
217 ctf_integer(long, new_scan, new_scan_cnt)
218 ctf_integer(int, retval, shrinker_retval)
219 ctf_integer(long, total_scan, new_scan_cnt - unused_scan_cnt)
220 )
221 )
222 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,16,0)) */
223 #endif
224
225 LTTNG_TRACEPOINT_EVENT_CLASS(mm_vmscan_lru_isolate_template,
226
227 TP_PROTO(int order,
228 unsigned long nr_requested,
229 unsigned long nr_scanned,
230 unsigned long nr_taken,
231 #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0))
232 unsigned long nr_lumpy_taken,
233 unsigned long nr_lumpy_dirty,
234 unsigned long nr_lumpy_failed,
235 #endif
236 #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0))
237 isolate_mode_t isolate_mode
238 #else
239 isolate_mode_t isolate_mode,
240 int file
241 #endif
242 ),
243
244 TP_ARGS(order, nr_requested, nr_scanned, nr_taken,
245 #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0))
246 nr_lumpy_taken, nr_lumpy_dirty, nr_lumpy_failed,
247 #endif
248 #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0))
249 isolate_mode
250 #else
251 isolate_mode, file
252 #endif
253 ),
254
255
256 TP_FIELDS(
257 ctf_integer(int, order, order)
258 ctf_integer(unsigned long, nr_requested, nr_requested)
259 ctf_integer(unsigned long, nr_scanned, nr_scanned)
260 ctf_integer(unsigned long, nr_taken, nr_taken)
261 #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0))
262 ctf_integer(unsigned long, nr_lumpy_taken, nr_lumpy_taken)
263 ctf_integer(unsigned long, nr_lumpy_dirty, nr_lumpy_dirty)
264 ctf_integer(unsigned long, nr_lumpy_failed, nr_lumpy_failed)
265 #endif
266 ctf_integer(isolate_mode_t, isolate_mode, isolate_mode)
267 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0))
268 ctf_integer(int, file, file)
269 #endif
270 )
271 )
272
273 LTTNG_TRACEPOINT_EVENT_INSTANCE(mm_vmscan_lru_isolate_template, mm_vmscan_lru_isolate,
274
275 TP_PROTO(int order,
276 unsigned long nr_requested,
277 unsigned long nr_scanned,
278 unsigned long nr_taken,
279 #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0))
280 unsigned long nr_lumpy_taken,
281 unsigned long nr_lumpy_dirty,
282 unsigned long nr_lumpy_failed,
283 #endif
284 #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0))
285 isolate_mode_t isolate_mode
286 #else
287 isolate_mode_t isolate_mode,
288 int file
289 #endif
290 ),
291
292 TP_ARGS(order, nr_requested, nr_scanned, nr_taken,
293 #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0))
294 nr_lumpy_taken, nr_lumpy_dirty, nr_lumpy_failed,
295 #endif
296 #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0))
297 isolate_mode
298 #else
299 isolate_mode, file
300 #endif
301 )
302
303 )
304
305 LTTNG_TRACEPOINT_EVENT_INSTANCE(mm_vmscan_lru_isolate_template, mm_vmscan_memcg_isolate,
306
307 TP_PROTO(int order,
308 unsigned long nr_requested,
309 unsigned long nr_scanned,
310 unsigned long nr_taken,
311 #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0))
312 unsigned long nr_lumpy_taken,
313 unsigned long nr_lumpy_dirty,
314 unsigned long nr_lumpy_failed,
315 #endif
316 #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0))
317 isolate_mode_t isolate_mode
318 #else
319 isolate_mode_t isolate_mode,
320 int file
321 #endif
322 ),
323
324 TP_ARGS(order, nr_requested, nr_scanned, nr_taken,
325 #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0))
326 nr_lumpy_taken, nr_lumpy_dirty, nr_lumpy_failed,
327 #endif
328 #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0))
329 isolate_mode
330 #else
331 isolate_mode, file
332 #endif
333 )
334 )
335
336 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,5,0))
337 LTTNG_TRACEPOINT_EVENT(mm_vmscan_writepage,
338
339 TP_PROTO(struct page *page),
340
341 TP_ARGS(page),
342
343 TP_FIELDS(
344 ctf_integer_hex(struct page *, page, page)
345 ctf_integer(int, reclaim_flags, trace_reclaim_flags(page))
346 )
347 )
348 #else
349 LTTNG_TRACEPOINT_EVENT(mm_vmscan_writepage,
350
351 TP_PROTO(struct page *page,
352 int reclaim_flags),
353
354 TP_ARGS(page, reclaim_flags),
355
356 TP_FIELDS(
357 ctf_integer_hex(struct page *, page, page)
358 ctf_integer(int, reclaim_flags, reclaim_flags)
359 )
360 )
361 #endif
362
363 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,5,0))
364 LTTNG_TRACEPOINT_EVENT(mm_vmscan_lru_shrink_inactive,
365
366 TP_PROTO(struct zone *zone,
367 unsigned long nr_scanned, unsigned long nr_reclaimed,
368 int priority, int file),
369
370 TP_ARGS(zone, nr_scanned, nr_reclaimed, priority, file),
371
372 TP_FIELDS(
373 ctf_integer(int, nid, zone_to_nid(zone))
374 ctf_integer(int, zid, zone_idx(zone))
375 ctf_integer(unsigned long, nr_scanned, nr_scanned)
376 ctf_integer(unsigned long, nr_reclaimed, nr_reclaimed)
377 ctf_integer(int, priority, priority)
378 ctf_integer(int, reclaim_flags, trace_shrink_flags(file))
379 )
380 )
381 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37))
382 LTTNG_TRACEPOINT_EVENT(mm_vmscan_lru_shrink_inactive,
383
384 TP_PROTO(int nid, int zid,
385 unsigned long nr_scanned, unsigned long nr_reclaimed,
386 int priority, int reclaim_flags),
387
388 TP_ARGS(nid, zid, nr_scanned, nr_reclaimed, priority, reclaim_flags),
389
390 TP_FIELDS(
391 ctf_integer(int, nid, nid)
392 ctf_integer(int, zid, zid)
393 ctf_integer(unsigned long, nr_scanned, nr_scanned)
394 ctf_integer(unsigned long, nr_reclaimed, nr_reclaimed)
395 ctf_integer(int, priority, priority)
396 ctf_integer(int, reclaim_flags, reclaim_flags)
397 )
398 )
399 #endif
400
401 #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0))
402 LTTNG_TRACEPOINT_EVENT_MAP(replace_swap_token,
403
404 mm_vmscan_replace_swap_token,
405
406 TP_PROTO(struct mm_struct *old_mm,
407 struct mm_struct *new_mm),
408
409 TP_ARGS(old_mm, new_mm),
410
411 TP_FIELDS(
412 ctf_integer_hex(struct mm_struct *, old_mm, old_mm)
413 ctf_integer(unsigned int, old_prio, old_mm ? old_mm->token_priority : 0)
414 ctf_integer_hex(struct mm_struct *, new_mm, new_mm)
415 ctf_integer(unsigned int, new_prio, new_mm->token_priority)
416 )
417 )
418
419 LTTNG_TRACEPOINT_EVENT_CLASS(mm_vmscan_put_swap_token_template,
420 TP_PROTO(struct mm_struct *swap_token_mm),
421
422 TP_ARGS(swap_token_mm),
423
424 TP_FIELDS(
425 ctf_integer_hex(struct mm_struct*, swap_token_mm, swap_token_mm)
426 )
427 )
428
429 LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(mm_vmscan_put_swap_token_template, put_swap_token,
430
431 mm_vmscan_put_swap_token,
432
433 TP_PROTO(struct mm_struct *swap_token_mm),
434 TP_ARGS(swap_token_mm)
435 )
436
437 LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(mm_vmscan_put_swap_token_template, disable_swap_token,
438
439 mm_vmscan_disable_swap_token,
440
441 TP_PROTO(struct mm_struct *swap_token_mm),
442 TP_ARGS(swap_token_mm)
443 )
444
445 LTTNG_TRACEPOINT_EVENT_MAP(update_swap_token_priority,
446
447 mm_vmscan_update_swap_token_priority,
448
449 TP_PROTO(struct mm_struct *mm,
450 unsigned int old_prio,
451 struct mm_struct *swap_token_mm),
452
453 TP_ARGS(mm, old_prio, swap_token_mm),
454
455 TP_FIELDS(
456 ctf_integer_hex(struct mm_struct *, mm, mm)
457 ctf_integer(unsigned int, old_prio, old_prio)
458 ctf_integer(unsigned int, new_prio, mm->token_priority)
459 ctf_integer_hex(struct mm_struct *, swap_token_mm, swap_token_mm)
460 ctf_integer(unsigned int, swap_token_prio, swap_token_mm ? swap_token_mm->token_priority : 0)
461 )
462 )
463 #endif
464
465 #endif /* LTTNG_TRACE_MM_VMSCAN_H */
466
467 /* This part must be outside protection */
468 #include "../../../probes/define_trace.h"
This page took 0.03956 seconds and 5 git commands to generate.