Commit | Line | Data |
---|---|---|
9f36eaed | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
b283666f | 2 | #undef TRACE_SYSTEM |
9bbf98da | 3 | #define TRACE_SYSTEM mm_vmscan |
b283666f | 4 | |
9bbf98da MD |
5 | #if !defined(LTTNG_TRACE_MM_VMSCAN_H) || defined(TRACE_HEADER_MULTI_READ) |
6 | #define LTTNG_TRACE_MM_VMSCAN_H | |
b283666f | 7 | |
6ec43db8 | 8 | #include <probes/lttng-tracepoint-event.h> |
7c68b363 | 9 | #include <linux/types.h> |
7c68b363 AG |
10 | #include <linux/mm.h> |
11 | #include <linux/memcontrol.h> | |
7c68b363 AG |
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 | ||
7c68b363 AG |
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 | ||
acdd49cf MJ |
29 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,2,0)) |
30 | ||
31 | #include <linux/mm_inline.h> | |
32 | ||
33 | #define trace_reclaim_flags(file) ( \ | |
34 | (file ? RECLAIM_WB_FILE : RECLAIM_WB_ANON) | \ | |
35 | (RECLAIM_WB_ASYNC) \ | |
36 | ) | |
37 | ||
38 | #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,5,0)) | |
01e289f7 MD |
39 | |
40 | #include <linux/mm_inline.h> | |
41 | ||
42 | #define trace_reclaim_flags(page) ( \ | |
43 | (page_is_file_cache(page) ? RECLAIM_WB_FILE : RECLAIM_WB_ANON) | \ | |
44 | (RECLAIM_WB_ASYNC) \ | |
45 | ) | |
46 | ||
47 | #define trace_shrink_flags(file) \ | |
48 | ( \ | |
49 | (file ? RECLAIM_WB_FILE : RECLAIM_WB_ANON) | \ | |
50 | (RECLAIM_WB_ASYNC) \ | |
51 | ) | |
52 | ||
53 | #endif | |
54 | ||
3bc29f0a | 55 | LTTNG_TRACEPOINT_EVENT(mm_vmscan_kswapd_sleep, |
b283666f PW |
56 | |
57 | TP_PROTO(int nid), | |
58 | ||
59 | TP_ARGS(nid), | |
60 | ||
f127e61e MD |
61 | TP_FIELDS( |
62 | ctf_integer(int, nid, nid) | |
63 | ) | |
b283666f PW |
64 | ) |
65 | ||
b2641821 MD |
66 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,8,0)) |
67 | ||
68 | LTTNG_TRACEPOINT_EVENT(mm_vmscan_kswapd_wake, | |
69 | ||
70 | TP_PROTO(int nid, int zid, int order), | |
71 | ||
72 | TP_ARGS(nid, zid, order), | |
73 | ||
74 | TP_FIELDS( | |
75 | ctf_integer(int, nid, nid) | |
76 | ctf_integer(int, zid, zid) | |
77 | ctf_integer(int, order, order) | |
78 | ) | |
79 | ) | |
80 | ||
81 | #else | |
82 | ||
3bc29f0a | 83 | LTTNG_TRACEPOINT_EVENT(mm_vmscan_kswapd_wake, |
b283666f PW |
84 | |
85 | TP_PROTO(int nid, int order), | |
86 | ||
87 | TP_ARGS(nid, order), | |
88 | ||
f127e61e MD |
89 | TP_FIELDS( |
90 | ctf_integer(int, nid, nid) | |
91 | ctf_integer(int, order, order) | |
92 | ) | |
b283666f PW |
93 | ) |
94 | ||
b2641821 MD |
95 | #endif |
96 | ||
95265e58 MJ |
97 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,17,0)) |
98 | LTTNG_TRACEPOINT_EVENT(mm_vmscan_wakeup_kswapd, | |
99 | ||
100 | TP_PROTO(int nid, int zid, int order, gfp_t gfp_flags), | |
101 | ||
102 | TP_ARGS(nid, zid, order, gfp_flags), | |
103 | ||
104 | TP_FIELDS( | |
105 | ctf_integer(int, nid, nid) | |
106 | ctf_integer(int, zid, zid) | |
107 | ctf_integer(int, order, order) | |
108 | ctf_integer(gfp_t, gfp_flags, gfp_flags) | |
109 | ) | |
110 | ) | |
111 | #else | |
3bc29f0a | 112 | LTTNG_TRACEPOINT_EVENT(mm_vmscan_wakeup_kswapd, |
b283666f PW |
113 | |
114 | TP_PROTO(int nid, int zid, int order), | |
115 | ||
116 | TP_ARGS(nid, zid, order), | |
117 | ||
f127e61e MD |
118 | TP_FIELDS( |
119 | ctf_integer(int, nid, nid) | |
120 | ctf_integer(int, zid, zid) | |
121 | ctf_integer(int, order, order) | |
122 | ) | |
b283666f | 123 | ) |
95265e58 | 124 | #endif |
b283666f | 125 | |
da00122c MJ |
126 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,2,0)) |
127 | ||
128 | LTTNG_TRACEPOINT_EVENT_CLASS(mm_vmscan_direct_reclaim_begin_template, | |
129 | ||
130 | TP_PROTO(int order, gfp_t gfp_flags), | |
131 | ||
132 | TP_ARGS(order, gfp_flags), | |
133 | ||
134 | TP_FIELDS( | |
135 | ctf_integer(int, order, order) | |
136 | ctf_integer(gfp_t, gfp_flags, gfp_flags) | |
137 | ) | |
138 | ) | |
139 | ||
140 | LTTNG_TRACEPOINT_EVENT_INSTANCE(mm_vmscan_direct_reclaim_begin_template, mm_vmscan_direct_reclaim_begin, | |
141 | ||
142 | TP_PROTO(int order, gfp_t gfp_flags), | |
143 | ||
144 | TP_ARGS(order, gfp_flags) | |
145 | ) | |
146 | ||
147 | LTTNG_TRACEPOINT_EVENT_INSTANCE(mm_vmscan_direct_reclaim_begin_template, mm_vmscan_memcg_reclaim_begin, | |
148 | ||
149 | TP_PROTO(int order, gfp_t gfp_flags), | |
150 | ||
151 | TP_ARGS(order, gfp_flags) | |
152 | ) | |
153 | ||
154 | LTTNG_TRACEPOINT_EVENT_INSTANCE(mm_vmscan_direct_reclaim_begin_template, mm_vmscan_memcg_softlimit_reclaim_begin, | |
155 | ||
156 | TP_PROTO(int order, gfp_t gfp_flags), | |
157 | ||
158 | TP_ARGS(order, gfp_flags) | |
159 | ) | |
160 | ||
161 | #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,8,0)) | |
b2641821 MD |
162 | |
163 | LTTNG_TRACEPOINT_EVENT_CLASS(mm_vmscan_direct_reclaim_begin_template, | |
164 | ||
165 | TP_PROTO(int order, int may_writepage, gfp_t gfp_flags, int classzone_idx), | |
166 | ||
167 | TP_ARGS(order, may_writepage, gfp_flags, classzone_idx), | |
168 | ||
169 | TP_FIELDS( | |
170 | ctf_integer(int, order, order) | |
171 | ctf_integer(int, may_writepage, may_writepage) | |
172 | ctf_integer(gfp_t, gfp_flags, gfp_flags) | |
173 | ctf_integer(int, classzone_idx, classzone_idx) | |
174 | ) | |
175 | ) | |
176 | ||
177 | LTTNG_TRACEPOINT_EVENT_INSTANCE(mm_vmscan_direct_reclaim_begin_template, mm_vmscan_direct_reclaim_begin, | |
178 | ||
179 | TP_PROTO(int order, int may_writepage, gfp_t gfp_flags, int classzone_idx), | |
180 | ||
181 | TP_ARGS(order, may_writepage, gfp_flags, classzone_idx) | |
182 | ) | |
183 | ||
184 | LTTNG_TRACEPOINT_EVENT_INSTANCE(mm_vmscan_direct_reclaim_begin_template, mm_vmscan_memcg_reclaim_begin, | |
185 | ||
186 | TP_PROTO(int order, int may_writepage, gfp_t gfp_flags, int classzone_idx), | |
187 | ||
188 | TP_ARGS(order, may_writepage, gfp_flags, classzone_idx) | |
189 | ) | |
190 | ||
191 | LTTNG_TRACEPOINT_EVENT_INSTANCE(mm_vmscan_direct_reclaim_begin_template, mm_vmscan_memcg_softlimit_reclaim_begin, | |
192 | ||
193 | TP_PROTO(int order, int may_writepage, gfp_t gfp_flags, int classzone_idx), | |
194 | ||
195 | TP_ARGS(order, may_writepage, gfp_flags, classzone_idx) | |
196 | ) | |
197 | ||
198 | #else | |
199 | ||
3bc29f0a | 200 | LTTNG_TRACEPOINT_EVENT_CLASS(mm_vmscan_direct_reclaim_begin_template, |
b283666f PW |
201 | |
202 | TP_PROTO(int order, int may_writepage, gfp_t gfp_flags), | |
203 | ||
204 | TP_ARGS(order, may_writepage, gfp_flags), | |
205 | ||
f127e61e MD |
206 | TP_FIELDS( |
207 | ctf_integer(int, order, order) | |
208 | ctf_integer(int, may_writepage, may_writepage) | |
209 | ctf_integer(gfp_t, gfp_flags, gfp_flags) | |
210 | ) | |
b283666f PW |
211 | ) |
212 | ||
3bc29f0a | 213 | LTTNG_TRACEPOINT_EVENT_INSTANCE(mm_vmscan_direct_reclaim_begin_template, mm_vmscan_direct_reclaim_begin, |
b283666f PW |
214 | |
215 | TP_PROTO(int order, int may_writepage, gfp_t gfp_flags), | |
216 | ||
217 | TP_ARGS(order, may_writepage, gfp_flags) | |
218 | ) | |
219 | ||
3bc29f0a | 220 | LTTNG_TRACEPOINT_EVENT_INSTANCE(mm_vmscan_direct_reclaim_begin_template, mm_vmscan_memcg_reclaim_begin, |
b283666f PW |
221 | |
222 | TP_PROTO(int order, int may_writepage, gfp_t gfp_flags), | |
223 | ||
224 | TP_ARGS(order, may_writepage, gfp_flags) | |
225 | ) | |
226 | ||
3bc29f0a | 227 | LTTNG_TRACEPOINT_EVENT_INSTANCE(mm_vmscan_direct_reclaim_begin_template, mm_vmscan_memcg_softlimit_reclaim_begin, |
b283666f PW |
228 | |
229 | TP_PROTO(int order, int may_writepage, gfp_t gfp_flags), | |
230 | ||
231 | TP_ARGS(order, may_writepage, gfp_flags) | |
232 | ) | |
233 | ||
b2641821 MD |
234 | #endif |
235 | ||
3bc29f0a | 236 | LTTNG_TRACEPOINT_EVENT_CLASS(mm_vmscan_direct_reclaim_end_template, |
b283666f PW |
237 | |
238 | TP_PROTO(unsigned long nr_reclaimed), | |
239 | ||
240 | TP_ARGS(nr_reclaimed), | |
241 | ||
f127e61e MD |
242 | TP_FIELDS( |
243 | ctf_integer(unsigned long, nr_reclaimed, nr_reclaimed) | |
244 | ) | |
b283666f PW |
245 | ) |
246 | ||
3bc29f0a | 247 | LTTNG_TRACEPOINT_EVENT_INSTANCE(mm_vmscan_direct_reclaim_end_template, mm_vmscan_direct_reclaim_end, |
b283666f PW |
248 | |
249 | TP_PROTO(unsigned long nr_reclaimed), | |
250 | ||
251 | TP_ARGS(nr_reclaimed) | |
252 | ) | |
253 | ||
3bc29f0a | 254 | LTTNG_TRACEPOINT_EVENT_INSTANCE(mm_vmscan_direct_reclaim_end_template, mm_vmscan_memcg_reclaim_end, |
b283666f PW |
255 | |
256 | TP_PROTO(unsigned long nr_reclaimed), | |
257 | ||
258 | TP_ARGS(nr_reclaimed) | |
259 | ) | |
260 | ||
3bc29f0a | 261 | LTTNG_TRACEPOINT_EVENT_INSTANCE(mm_vmscan_direct_reclaim_end_template, mm_vmscan_memcg_softlimit_reclaim_end, |
b283666f PW |
262 | |
263 | TP_PROTO(unsigned long nr_reclaimed), | |
264 | ||
265 | TP_ARGS(nr_reclaimed) | |
266 | ) | |
267 | ||
9cf057fc MJ |
268 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,16,0)) |
269 | LTTNG_TRACEPOINT_EVENT_MAP(mm_shrink_slab_start, | |
270 | ||
271 | mm_vmscan_shrink_slab_start, | |
272 | ||
273 | TP_PROTO(struct shrinker *shr, struct shrink_control *sc, | |
274 | long nr_objects_to_shrink, unsigned long cache_items, | |
275 | unsigned long long delta, unsigned long total_scan, | |
276 | int priority), | |
277 | ||
278 | TP_ARGS(shr, sc, nr_objects_to_shrink, cache_items, delta, total_scan, | |
279 | priority), | |
280 | ||
281 | TP_FIELDS( | |
282 | ctf_integer_hex(struct shrinker *, shr, shr) | |
283 | ctf_integer_hex(void *, shrink, shr->scan_objects) | |
284 | ctf_integer(int, nid, sc->nid) | |
285 | ctf_integer(long, nr_objects_to_shrink, nr_objects_to_shrink) | |
286 | ctf_integer(gfp_t, gfp_flags, sc->gfp_mask) | |
287 | ctf_integer(unsigned long, cache_items, cache_items) | |
288 | ctf_integer(unsigned long long, delta, delta) | |
289 | ctf_integer(unsigned long, total_scan, total_scan) | |
290 | ctf_integer(int, priority, priority) | |
291 | ) | |
292 | ) | |
293 | #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0)) | |
9bbf98da MD |
294 | LTTNG_TRACEPOINT_EVENT_MAP(mm_shrink_slab_start, |
295 | ||
296 | mm_vmscan_shrink_slab_start, | |
297 | ||
b283666f PW |
298 | TP_PROTO(struct shrinker *shr, struct shrink_control *sc, |
299 | long nr_objects_to_shrink, unsigned long pgs_scanned, | |
300 | unsigned long lru_pgs, unsigned long cache_items, | |
301 | unsigned long long delta, unsigned long total_scan), | |
302 | ||
303 | TP_ARGS(shr, sc, nr_objects_to_shrink, pgs_scanned, lru_pgs, | |
304 | cache_items, delta, total_scan), | |
305 | ||
f127e61e | 306 | TP_FIELDS( |
fa91fcac | 307 | ctf_integer_hex(struct shrinker *, shr, shr) |
5465fedd | 308 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0)) |
fa91fcac | 309 | ctf_integer_hex(void *, shrink, shr->scan_objects) |
5465fedd | 310 | #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0)) */ |
fa91fcac | 311 | ctf_integer_hex(void *, shrink, shr->shrink) |
5465fedd | 312 | #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0)) */ |
f127e61e MD |
313 | ctf_integer(long, nr_objects_to_shrink, nr_objects_to_shrink) |
314 | ctf_integer(gfp_t, gfp_flags, sc->gfp_mask) | |
315 | ctf_integer(unsigned long, pgs_scanned, pgs_scanned) | |
316 | ctf_integer(unsigned long, lru_pgs, lru_pgs) | |
317 | ctf_integer(unsigned long, cache_items, cache_items) | |
318 | ctf_integer(unsigned long long, delta, delta) | |
319 | ctf_integer(unsigned long, total_scan, total_scan) | |
320 | ) | |
b283666f | 321 | ) |
9cf057fc | 322 | #endif |
b283666f | 323 | |
5defe623 | 324 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,16,0)) |
9bbf98da MD |
325 | LTTNG_TRACEPOINT_EVENT_MAP(mm_shrink_slab_end, |
326 | ||
327 | mm_vmscan_shrink_slab_end, | |
328 | ||
5defe623 MD |
329 | TP_PROTO(struct shrinker *shr, int nid, int shrinker_retval, |
330 | long unused_scan_cnt, long new_scan_cnt, long total_scan), | |
331 | ||
332 | TP_ARGS(shr, nid, shrinker_retval, unused_scan_cnt, new_scan_cnt, | |
333 | total_scan), | |
334 | ||
f127e61e | 335 | TP_FIELDS( |
fa91fcac | 336 | ctf_integer_hex(struct shrinker *, shr, shr) |
f127e61e | 337 | ctf_integer(int, nid, nid) |
fa91fcac | 338 | ctf_integer_hex(void *, shrink, shr->scan_objects) |
f127e61e MD |
339 | ctf_integer(long, unused_scan, unused_scan_cnt) |
340 | ctf_integer(long, new_scan, new_scan_cnt) | |
341 | ctf_integer(int, retval, shrinker_retval) | |
342 | ctf_integer(long, total_scan, total_scan) | |
343 | ) | |
5defe623 | 344 | ) |
9cf057fc | 345 | #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0)) |
9bbf98da MD |
346 | LTTNG_TRACEPOINT_EVENT_MAP(mm_shrink_slab_end, |
347 | ||
348 | mm_vmscan_shrink_slab_end, | |
349 | ||
b283666f PW |
350 | TP_PROTO(struct shrinker *shr, int shrinker_retval, |
351 | long unused_scan_cnt, long new_scan_cnt), | |
352 | ||
353 | TP_ARGS(shr, shrinker_retval, unused_scan_cnt, new_scan_cnt), | |
354 | ||
f127e61e | 355 | TP_FIELDS( |
fa91fcac | 356 | ctf_integer_hex(struct shrinker *, shr, shr) |
5465fedd | 357 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0)) |
fa91fcac | 358 | ctf_integer_hex(void *, shrink, shr->scan_objects) |
5465fedd | 359 | #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0)) */ |
fa91fcac | 360 | ctf_integer_hex(void *, shrink, shr->shrink) |
5465fedd | 361 | #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0)) */ |
f127e61e MD |
362 | ctf_integer(long, unused_scan, unused_scan_cnt) |
363 | ctf_integer(long, new_scan, new_scan_cnt) | |
364 | ctf_integer(int, retval, shrinker_retval) | |
365 | ctf_integer(long, total_scan, new_scan_cnt - unused_scan_cnt) | |
366 | ) | |
b283666f | 367 | ) |
7c68b363 | 368 | #endif |
b283666f | 369 | |
75833a88 FD |
370 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0)) |
371 | LTTNG_TRACEPOINT_EVENT(mm_vmscan_lru_isolate, | |
372 | ||
373 | TP_PROTO(int classzone_idx, | |
374 | int order, | |
375 | unsigned long nr_requested, | |
376 | unsigned long nr_scanned, | |
377 | unsigned long nr_skipped, | |
378 | unsigned long nr_taken, | |
379 | isolate_mode_t isolate_mode, | |
380 | int lru | |
381 | ), | |
b2641821 | 382 | |
75833a88 FD |
383 | TP_ARGS(classzone_idx, order, nr_requested, nr_scanned, nr_skipped, |
384 | nr_taken, isolate_mode, lru | |
385 | ), | |
386 | ||
387 | TP_FIELDS( | |
388 | ctf_integer(int, classzone_idx, classzone_idx) | |
389 | ctf_integer(int, order, order) | |
390 | ctf_integer(unsigned long, nr_requested, nr_requested) | |
391 | ctf_integer(unsigned long, nr_scanned, nr_scanned) | |
392 | ctf_integer(unsigned long, nr_skipped, nr_skipped) | |
393 | ctf_integer(unsigned long, nr_taken, nr_taken) | |
394 | ctf_integer(isolate_mode_t, isolate_mode, isolate_mode) | |
395 | ctf_integer(int, lru, lru) | |
396 | ) | |
397 | ) | |
398 | #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,8,0)) | |
b2641821 MD |
399 | LTTNG_TRACEPOINT_EVENT_CLASS(mm_vmscan_lru_isolate_template, |
400 | ||
401 | TP_PROTO(int classzone_idx, | |
402 | int order, | |
403 | unsigned long nr_requested, | |
404 | unsigned long nr_scanned, | |
405 | unsigned long nr_taken, | |
406 | isolate_mode_t isolate_mode, | |
407 | int file | |
408 | ), | |
409 | ||
410 | TP_ARGS(classzone_idx, order, nr_requested, nr_scanned, nr_taken, | |
411 | isolate_mode, file | |
412 | ), | |
413 | ||
414 | ||
415 | TP_FIELDS( | |
416 | ctf_integer(int, classzone_idx, classzone_idx) | |
417 | ctf_integer(int, order, order) | |
418 | ctf_integer(unsigned long, nr_requested, nr_requested) | |
419 | ctf_integer(unsigned long, nr_scanned, nr_scanned) | |
420 | ctf_integer(unsigned long, nr_taken, nr_taken) | |
421 | ctf_integer(isolate_mode_t, isolate_mode, isolate_mode) | |
422 | ctf_integer(int, file, file) | |
423 | ) | |
424 | ) | |
425 | ||
426 | LTTNG_TRACEPOINT_EVENT_INSTANCE(mm_vmscan_lru_isolate_template, mm_vmscan_lru_isolate, | |
427 | ||
428 | TP_PROTO(int classzone_idx, | |
429 | int order, | |
430 | unsigned long nr_requested, | |
431 | unsigned long nr_scanned, | |
432 | unsigned long nr_taken, | |
433 | isolate_mode_t isolate_mode, | |
434 | int file | |
435 | ), | |
436 | ||
437 | TP_ARGS(classzone_idx, order, nr_requested, nr_scanned, nr_taken, | |
438 | isolate_mode, file | |
439 | ) | |
440 | ||
441 | ) | |
442 | ||
443 | LTTNG_TRACEPOINT_EVENT_INSTANCE(mm_vmscan_lru_isolate_template, mm_vmscan_memcg_isolate, | |
444 | ||
445 | TP_PROTO(int classzone_idx, | |
446 | int order, | |
447 | unsigned long nr_requested, | |
448 | unsigned long nr_scanned, | |
449 | unsigned long nr_taken, | |
450 | isolate_mode_t isolate_mode, | |
451 | int file | |
452 | ), | |
453 | ||
454 | TP_ARGS(classzone_idx, order, nr_requested, nr_scanned, nr_taken, | |
455 | isolate_mode, file | |
456 | ) | |
457 | ) | |
b2641821 | 458 | #else |
3bc29f0a | 459 | LTTNG_TRACEPOINT_EVENT_CLASS(mm_vmscan_lru_isolate_template, |
b283666f PW |
460 | |
461 | TP_PROTO(int order, | |
462 | unsigned long nr_requested, | |
463 | unsigned long nr_scanned, | |
464 | unsigned long nr_taken, | |
7c68b363 | 465 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0)) |
b283666f PW |
466 | unsigned long nr_lumpy_taken, |
467 | unsigned long nr_lumpy_dirty, | |
468 | unsigned long nr_lumpy_failed, | |
7c68b363 | 469 | #endif |
b283666f | 470 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0)) |
7c68b363 | 471 | isolate_mode_t isolate_mode |
b283666f PW |
472 | #else |
473 | isolate_mode_t isolate_mode, | |
7c68b363 | 474 | int file |
b283666f | 475 | #endif |
7c68b363 | 476 | ), |
b283666f | 477 | |
7c68b363 AG |
478 | TP_ARGS(order, nr_requested, nr_scanned, nr_taken, |
479 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0)) | |
480 | nr_lumpy_taken, nr_lumpy_dirty, nr_lumpy_failed, | |
481 | #endif | |
b283666f | 482 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0)) |
7c68b363 | 483 | isolate_mode |
b283666f | 484 | #else |
7c68b363 | 485 | isolate_mode, file |
b283666f | 486 | #endif |
7c68b363 AG |
487 | ), |
488 | ||
b283666f | 489 | |
f127e61e MD |
490 | TP_FIELDS( |
491 | ctf_integer(int, order, order) | |
492 | ctf_integer(unsigned long, nr_requested, nr_requested) | |
493 | ctf_integer(unsigned long, nr_scanned, nr_scanned) | |
494 | ctf_integer(unsigned long, nr_taken, nr_taken) | |
7c68b363 | 495 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0)) |
f127e61e MD |
496 | ctf_integer(unsigned long, nr_lumpy_taken, nr_lumpy_taken) |
497 | ctf_integer(unsigned long, nr_lumpy_dirty, nr_lumpy_dirty) | |
498 | ctf_integer(unsigned long, nr_lumpy_failed, nr_lumpy_failed) | |
7c68b363 | 499 | #endif |
f127e61e | 500 | ctf_integer(isolate_mode_t, isolate_mode, isolate_mode) |
b283666f | 501 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0)) |
f127e61e | 502 | ctf_integer(int, file, file) |
b283666f | 503 | #endif |
f127e61e | 504 | ) |
b283666f PW |
505 | ) |
506 | ||
3bc29f0a | 507 | LTTNG_TRACEPOINT_EVENT_INSTANCE(mm_vmscan_lru_isolate_template, mm_vmscan_lru_isolate, |
b283666f PW |
508 | |
509 | TP_PROTO(int order, | |
510 | unsigned long nr_requested, | |
511 | unsigned long nr_scanned, | |
512 | unsigned long nr_taken, | |
513 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0)) | |
514 | unsigned long nr_lumpy_taken, | |
515 | unsigned long nr_lumpy_dirty, | |
516 | unsigned long nr_lumpy_failed, | |
517 | #endif | |
518 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0)) | |
7c68b363 | 519 | isolate_mode_t isolate_mode |
b283666f PW |
520 | #else |
521 | isolate_mode_t isolate_mode, | |
7c68b363 | 522 | int file |
b283666f | 523 | #endif |
7c68b363 | 524 | ), |
b283666f | 525 | |
7c68b363 AG |
526 | TP_ARGS(order, nr_requested, nr_scanned, nr_taken, |
527 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0)) | |
528 | nr_lumpy_taken, nr_lumpy_dirty, nr_lumpy_failed, | |
529 | #endif | |
b283666f | 530 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0)) |
7c68b363 | 531 | isolate_mode |
b283666f | 532 | #else |
7c68b363 | 533 | isolate_mode, file |
b283666f | 534 | #endif |
7c68b363 | 535 | ) |
b283666f PW |
536 | |
537 | ) | |
538 | ||
3bc29f0a | 539 | LTTNG_TRACEPOINT_EVENT_INSTANCE(mm_vmscan_lru_isolate_template, mm_vmscan_memcg_isolate, |
b283666f PW |
540 | |
541 | TP_PROTO(int order, | |
542 | unsigned long nr_requested, | |
543 | unsigned long nr_scanned, | |
544 | unsigned long nr_taken, | |
545 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0)) | |
546 | unsigned long nr_lumpy_taken, | |
547 | unsigned long nr_lumpy_dirty, | |
548 | unsigned long nr_lumpy_failed, | |
549 | #endif | |
550 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0)) | |
7c68b363 | 551 | isolate_mode_t isolate_mode |
b283666f PW |
552 | #else |
553 | isolate_mode_t isolate_mode, | |
7c68b363 | 554 | int file |
b283666f | 555 | #endif |
7c68b363 | 556 | ), |
b283666f | 557 | |
7c68b363 AG |
558 | TP_ARGS(order, nr_requested, nr_scanned, nr_taken, |
559 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0)) | |
560 | nr_lumpy_taken, nr_lumpy_dirty, nr_lumpy_failed, | |
561 | #endif | |
b283666f | 562 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0)) |
7c68b363 | 563 | isolate_mode |
b283666f | 564 | #else |
7c68b363 | 565 | isolate_mode, file |
b283666f | 566 | #endif |
7c68b363 | 567 | ) |
b283666f | 568 | ) |
b2641821 MD |
569 | #endif |
570 | ||
71a7580f MD |
571 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,7,0)) |
572 | LTTNG_TRACEPOINT_EVENT(mm_vmscan_writepage, | |
573 | ||
574 | TP_PROTO(struct page *page), | |
575 | ||
576 | TP_ARGS(page), | |
577 | ||
578 | TP_FIELDS( | |
579 | ctf_integer_hex(struct page *, page, page) | |
580 | ctf_integer(int, reclaim_flags, trace_reclaim_flags( | |
581 | page_is_file_lru(page))) | |
582 | ) | |
583 | ) | |
584 | #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(5,2,0)) | |
acdd49cf MJ |
585 | LTTNG_TRACEPOINT_EVENT(mm_vmscan_writepage, |
586 | ||
587 | TP_PROTO(struct page *page), | |
588 | ||
589 | TP_ARGS(page), | |
590 | ||
591 | TP_FIELDS( | |
592 | ctf_integer_hex(struct page *, page, page) | |
593 | ctf_integer(int, reclaim_flags, trace_reclaim_flags( | |
594 | page_is_file_cache(page))) | |
595 | ) | |
596 | ) | |
597 | #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,5,0)) | |
01e289f7 MD |
598 | LTTNG_TRACEPOINT_EVENT(mm_vmscan_writepage, |
599 | ||
600 | TP_PROTO(struct page *page), | |
601 | ||
602 | TP_ARGS(page), | |
603 | ||
604 | TP_FIELDS( | |
fa91fcac | 605 | ctf_integer_hex(struct page *, page, page) |
01e289f7 MD |
606 | ctf_integer(int, reclaim_flags, trace_reclaim_flags(page)) |
607 | ) | |
608 | ) | |
609 | #else | |
3bc29f0a | 610 | LTTNG_TRACEPOINT_EVENT(mm_vmscan_writepage, |
b283666f PW |
611 | |
612 | TP_PROTO(struct page *page, | |
613 | int reclaim_flags), | |
614 | ||
615 | TP_ARGS(page, reclaim_flags), | |
616 | ||
f127e61e | 617 | TP_FIELDS( |
fa91fcac | 618 | ctf_integer_hex(struct page *, page, page) |
f127e61e MD |
619 | ctf_integer(int, reclaim_flags, reclaim_flags) |
620 | ) | |
b283666f | 621 | ) |
01e289f7 MD |
622 | #endif |
623 | ||
acdd49cf MJ |
624 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,2,0)) |
625 | LTTNG_TRACEPOINT_EVENT(mm_vmscan_lru_shrink_inactive, | |
626 | ||
627 | TP_PROTO(int nid, | |
628 | unsigned long nr_scanned, unsigned long nr_reclaimed, | |
629 | struct reclaim_stat *stat, int priority, int file), | |
630 | ||
631 | TP_ARGS(nid, nr_scanned, nr_reclaimed, stat, priority, file), | |
632 | ||
633 | TP_FIELDS( | |
634 | ctf_integer(int, nid, nid) | |
635 | ctf_integer(unsigned long, nr_scanned, nr_scanned) | |
636 | ctf_integer(unsigned long, nr_reclaimed, nr_reclaimed) | |
637 | ctf_integer(unsigned long, nr_dirty, stat->nr_dirty) | |
638 | ctf_integer(unsigned long, nr_writeback, stat->nr_writeback) | |
639 | ctf_integer(unsigned long, nr_congested, stat->nr_congested) | |
640 | ctf_integer(unsigned long, nr_immediate, stat->nr_immediate) | |
cf9d6539 MJ |
641 | ctf_integer(unsigned long, nr_activate_anon, stat->nr_activate[0]) |
642 | ctf_integer(unsigned long, nr_activate_file, stat->nr_activate[1]) | |
acdd49cf MJ |
643 | ctf_integer(unsigned long, nr_ref_keep, stat->nr_ref_keep) |
644 | ctf_integer(unsigned long, nr_unmap_fail, stat->nr_unmap_fail) | |
645 | ctf_integer(int, priority, priority) | |
646 | ctf_integer(int, reclaim_flags, trace_reclaim_flags(file)) | |
647 | ) | |
648 | ) | |
649 | #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,17,0)) | |
00017921 MJ |
650 | LTTNG_TRACEPOINT_EVENT(mm_vmscan_lru_shrink_inactive, |
651 | ||
652 | TP_PROTO(int nid, | |
653 | unsigned long nr_scanned, unsigned long nr_reclaimed, | |
654 | struct reclaim_stat *stat, int priority, int file), | |
655 | ||
656 | TP_ARGS(nid, nr_scanned, nr_reclaimed, stat, priority, file), | |
657 | ||
658 | TP_FIELDS( | |
659 | ctf_integer(int, nid, nid) | |
660 | ctf_integer(unsigned long, nr_scanned, nr_scanned) | |
661 | ctf_integer(unsigned long, nr_reclaimed, nr_reclaimed) | |
662 | ctf_integer(unsigned long, nr_dirty, stat->nr_dirty) | |
663 | ctf_integer(unsigned long, nr_writeback, stat->nr_writeback) | |
664 | ctf_integer(unsigned long, nr_congested, stat->nr_congested) | |
665 | ctf_integer(unsigned long, nr_immediate, stat->nr_immediate) | |
666 | ctf_integer(unsigned long, nr_activate, stat->nr_activate) | |
667 | ctf_integer(unsigned long, nr_ref_keep, stat->nr_ref_keep) | |
668 | ctf_integer(unsigned long, nr_unmap_fail, stat->nr_unmap_fail) | |
669 | ctf_integer(int, priority, priority) | |
670 | ctf_integer(int, reclaim_flags, trace_shrink_flags(file)) | |
671 | ) | |
672 | ) | |
673 | #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0)) | |
75833a88 FD |
674 | LTTNG_TRACEPOINT_EVENT(mm_vmscan_lru_shrink_inactive, |
675 | ||
676 | TP_PROTO(int nid, | |
677 | unsigned long nr_scanned, unsigned long nr_reclaimed, | |
678 | unsigned long nr_dirty, unsigned long nr_writeback, | |
679 | unsigned long nr_congested, unsigned long nr_immediate, | |
680 | unsigned long nr_activate, unsigned long nr_ref_keep, | |
681 | unsigned long nr_unmap_fail, | |
682 | int priority, int file), | |
683 | ||
684 | TP_ARGS(nid, nr_scanned, nr_reclaimed, nr_dirty, nr_writeback, | |
685 | nr_congested, nr_immediate, nr_activate, nr_ref_keep, | |
686 | nr_unmap_fail, priority, file), | |
687 | ||
688 | TP_FIELDS( | |
689 | ctf_integer(int, nid, nid) | |
690 | ctf_integer(unsigned long, nr_scanned, nr_scanned) | |
691 | ctf_integer(unsigned long, nr_reclaimed, nr_reclaimed) | |
692 | ctf_integer(unsigned long, nr_dirty, nr_dirty) | |
693 | ctf_integer(unsigned long, nr_writeback, nr_writeback) | |
694 | ctf_integer(unsigned long, nr_congested, nr_congested) | |
695 | ctf_integer(unsigned long, nr_immediate, nr_immediate) | |
696 | ctf_integer(unsigned long, nr_activate, nr_activate) | |
697 | ctf_integer(unsigned long, nr_ref_keep, nr_ref_keep) | |
698 | ctf_integer(unsigned long, nr_unmap_fail, nr_unmap_fail) | |
699 | ctf_integer(int, priority, priority) | |
700 | ctf_integer(int, reclaim_flags, trace_shrink_flags(file)) | |
701 | ) | |
702 | ) | |
703 | #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,8,0)) | |
b2641821 MD |
704 | LTTNG_TRACEPOINT_EVENT(mm_vmscan_lru_shrink_inactive, |
705 | ||
706 | TP_PROTO(int nid, | |
707 | unsigned long nr_scanned, unsigned long nr_reclaimed, | |
708 | int priority, int file), | |
709 | ||
710 | TP_ARGS(nid, nr_scanned, nr_reclaimed, priority, file), | |
711 | ||
712 | TP_FIELDS( | |
713 | ctf_integer(int, nid, nid) | |
714 | ctf_integer(unsigned long, nr_scanned, nr_scanned) | |
715 | ctf_integer(unsigned long, nr_reclaimed, nr_reclaimed) | |
716 | ctf_integer(int, priority, priority) | |
717 | ctf_integer(int, reclaim_flags, trace_shrink_flags(file)) | |
718 | ) | |
719 | ) | |
720 | #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,5,0)) | |
01e289f7 MD |
721 | LTTNG_TRACEPOINT_EVENT(mm_vmscan_lru_shrink_inactive, |
722 | ||
723 | TP_PROTO(struct zone *zone, | |
724 | unsigned long nr_scanned, unsigned long nr_reclaimed, | |
725 | int priority, int file), | |
b283666f | 726 | |
01e289f7 MD |
727 | TP_ARGS(zone, nr_scanned, nr_reclaimed, priority, file), |
728 | ||
729 | TP_FIELDS( | |
730 | ctf_integer(int, nid, zone_to_nid(zone)) | |
731 | ctf_integer(int, zid, zone_idx(zone)) | |
732 | ctf_integer(unsigned long, nr_scanned, nr_scanned) | |
733 | ctf_integer(unsigned long, nr_reclaimed, nr_reclaimed) | |
734 | ctf_integer(int, priority, priority) | |
735 | ctf_integer(int, reclaim_flags, trace_shrink_flags(file)) | |
736 | ) | |
737 | ) | |
738 | #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) | |
3bc29f0a | 739 | LTTNG_TRACEPOINT_EVENT(mm_vmscan_lru_shrink_inactive, |
b283666f PW |
740 | |
741 | TP_PROTO(int nid, int zid, | |
742 | unsigned long nr_scanned, unsigned long nr_reclaimed, | |
743 | int priority, int reclaim_flags), | |
744 | ||
745 | TP_ARGS(nid, zid, nr_scanned, nr_reclaimed, priority, reclaim_flags), | |
746 | ||
f127e61e MD |
747 | TP_FIELDS( |
748 | ctf_integer(int, nid, nid) | |
749 | ctf_integer(int, zid, zid) | |
750 | ctf_integer(unsigned long, nr_scanned, nr_scanned) | |
751 | ctf_integer(unsigned long, nr_reclaimed, nr_reclaimed) | |
752 | ctf_integer(int, priority, priority) | |
753 | ctf_integer(int, reclaim_flags, reclaim_flags) | |
754 | ) | |
b283666f | 755 | ) |
7c68b363 | 756 | #endif |
b283666f PW |
757 | |
758 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0)) | |
3bc29f0a | 759 | LTTNG_TRACEPOINT_EVENT_MAP(replace_swap_token, |
9cf29d3e MD |
760 | |
761 | mm_vmscan_replace_swap_token, | |
762 | ||
b283666f PW |
763 | TP_PROTO(struct mm_struct *old_mm, |
764 | struct mm_struct *new_mm), | |
765 | ||
766 | TP_ARGS(old_mm, new_mm), | |
767 | ||
f127e61e | 768 | TP_FIELDS( |
fa91fcac | 769 | ctf_integer_hex(struct mm_struct *, old_mm, old_mm) |
f127e61e | 770 | ctf_integer(unsigned int, old_prio, old_mm ? old_mm->token_priority : 0) |
fa91fcac | 771 | ctf_integer_hex(struct mm_struct *, new_mm, new_mm) |
f127e61e MD |
772 | ctf_integer(unsigned int, new_prio, new_mm->token_priority) |
773 | ) | |
b283666f PW |
774 | ) |
775 | ||
3bc29f0a | 776 | LTTNG_TRACEPOINT_EVENT_CLASS(mm_vmscan_put_swap_token_template, |
b283666f PW |
777 | TP_PROTO(struct mm_struct *swap_token_mm), |
778 | ||
779 | TP_ARGS(swap_token_mm), | |
780 | ||
f127e61e | 781 | TP_FIELDS( |
fa91fcac | 782 | ctf_integer_hex(struct mm_struct*, swap_token_mm, swap_token_mm) |
f127e61e | 783 | ) |
b283666f PW |
784 | ) |
785 | ||
3bc29f0a | 786 | LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(mm_vmscan_put_swap_token_template, put_swap_token, |
9cf29d3e MD |
787 | |
788 | mm_vmscan_put_swap_token, | |
789 | ||
b283666f PW |
790 | TP_PROTO(struct mm_struct *swap_token_mm), |
791 | TP_ARGS(swap_token_mm) | |
792 | ) | |
793 | ||
f127e61e | 794 | LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(mm_vmscan_put_swap_token_template, disable_swap_token, |
9cf29d3e MD |
795 | |
796 | mm_vmscan_disable_swap_token, | |
797 | ||
b283666f | 798 | TP_PROTO(struct mm_struct *swap_token_mm), |
f127e61e | 799 | TP_ARGS(swap_token_mm) |
b283666f PW |
800 | ) |
801 | ||
f127e61e | 802 | LTTNG_TRACEPOINT_EVENT_MAP(update_swap_token_priority, |
9cf29d3e MD |
803 | |
804 | mm_vmscan_update_swap_token_priority, | |
805 | ||
b283666f PW |
806 | TP_PROTO(struct mm_struct *mm, |
807 | unsigned int old_prio, | |
808 | struct mm_struct *swap_token_mm), | |
809 | ||
810 | TP_ARGS(mm, old_prio, swap_token_mm), | |
811 | ||
f127e61e | 812 | TP_FIELDS( |
fa91fcac | 813 | ctf_integer_hex(struct mm_struct *, mm, mm) |
f127e61e MD |
814 | ctf_integer(unsigned int, old_prio, old_prio) |
815 | ctf_integer(unsigned int, new_prio, mm->token_priority) | |
fa91fcac | 816 | ctf_integer_hex(struct mm_struct *, swap_token_mm, swap_token_mm) |
f127e61e MD |
817 | ctf_integer(unsigned int, swap_token_prio, swap_token_mm ? swap_token_mm->token_priority : 0) |
818 | ) | |
b283666f | 819 | ) |
b283666f PW |
820 | #endif |
821 | ||
9bbf98da | 822 | #endif /* LTTNG_TRACE_MM_VMSCAN_H */ |
b283666f PW |
823 | |
824 | /* This part must be outside protection */ | |
6ec43db8 | 825 | #include <probes/define_trace.h> |