| 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 | LTTNG_TRACEPOINT_EVENT(mm_vmscan_kswapd_sleep, |
| 30 | |
| 31 | TP_PROTO(int nid), |
| 32 | |
| 33 | TP_ARGS(nid), |
| 34 | |
| 35 | TP_FIELDS( |
| 36 | ctf_integer(int, nid, nid) |
| 37 | ) |
| 38 | ) |
| 39 | |
| 40 | LTTNG_TRACEPOINT_EVENT(mm_vmscan_kswapd_wake, |
| 41 | |
| 42 | TP_PROTO(int nid, int order), |
| 43 | |
| 44 | TP_ARGS(nid, order), |
| 45 | |
| 46 | TP_FIELDS( |
| 47 | ctf_integer(int, nid, nid) |
| 48 | ctf_integer(int, order, order) |
| 49 | ) |
| 50 | ) |
| 51 | |
| 52 | LTTNG_TRACEPOINT_EVENT(mm_vmscan_wakeup_kswapd, |
| 53 | |
| 54 | TP_PROTO(int nid, int zid, int order), |
| 55 | |
| 56 | TP_ARGS(nid, zid, order), |
| 57 | |
| 58 | TP_FIELDS( |
| 59 | ctf_integer(int, nid, nid) |
| 60 | ctf_integer(int, zid, zid) |
| 61 | ctf_integer(int, order, order) |
| 62 | ) |
| 63 | ) |
| 64 | |
| 65 | LTTNG_TRACEPOINT_EVENT_CLASS(mm_vmscan_direct_reclaim_begin_template, |
| 66 | |
| 67 | TP_PROTO(int order, int may_writepage, gfp_t gfp_flags), |
| 68 | |
| 69 | TP_ARGS(order, may_writepage, gfp_flags), |
| 70 | |
| 71 | TP_FIELDS( |
| 72 | ctf_integer(int, order, order) |
| 73 | ctf_integer(int, may_writepage, may_writepage) |
| 74 | ctf_integer(gfp_t, gfp_flags, gfp_flags) |
| 75 | ) |
| 76 | ) |
| 77 | |
| 78 | LTTNG_TRACEPOINT_EVENT_INSTANCE(mm_vmscan_direct_reclaim_begin_template, mm_vmscan_direct_reclaim_begin, |
| 79 | |
| 80 | TP_PROTO(int order, int may_writepage, gfp_t gfp_flags), |
| 81 | |
| 82 | TP_ARGS(order, may_writepage, gfp_flags) |
| 83 | ) |
| 84 | |
| 85 | LTTNG_TRACEPOINT_EVENT_INSTANCE(mm_vmscan_direct_reclaim_begin_template, mm_vmscan_memcg_reclaim_begin, |
| 86 | |
| 87 | TP_PROTO(int order, int may_writepage, gfp_t gfp_flags), |
| 88 | |
| 89 | TP_ARGS(order, may_writepage, gfp_flags) |
| 90 | ) |
| 91 | |
| 92 | LTTNG_TRACEPOINT_EVENT_INSTANCE(mm_vmscan_direct_reclaim_begin_template, mm_vmscan_memcg_softlimit_reclaim_begin, |
| 93 | |
| 94 | TP_PROTO(int order, int may_writepage, gfp_t gfp_flags), |
| 95 | |
| 96 | TP_ARGS(order, may_writepage, gfp_flags) |
| 97 | ) |
| 98 | |
| 99 | LTTNG_TRACEPOINT_EVENT_CLASS(mm_vmscan_direct_reclaim_end_template, |
| 100 | |
| 101 | TP_PROTO(unsigned long nr_reclaimed), |
| 102 | |
| 103 | TP_ARGS(nr_reclaimed), |
| 104 | |
| 105 | TP_FIELDS( |
| 106 | ctf_integer(unsigned long, nr_reclaimed, nr_reclaimed) |
| 107 | ) |
| 108 | ) |
| 109 | |
| 110 | LTTNG_TRACEPOINT_EVENT_INSTANCE(mm_vmscan_direct_reclaim_end_template, mm_vmscan_direct_reclaim_end, |
| 111 | |
| 112 | TP_PROTO(unsigned long nr_reclaimed), |
| 113 | |
| 114 | TP_ARGS(nr_reclaimed) |
| 115 | ) |
| 116 | |
| 117 | LTTNG_TRACEPOINT_EVENT_INSTANCE(mm_vmscan_direct_reclaim_end_template, mm_vmscan_memcg_reclaim_end, |
| 118 | |
| 119 | TP_PROTO(unsigned long nr_reclaimed), |
| 120 | |
| 121 | TP_ARGS(nr_reclaimed) |
| 122 | ) |
| 123 | |
| 124 | LTTNG_TRACEPOINT_EVENT_INSTANCE(mm_vmscan_direct_reclaim_end_template, mm_vmscan_memcg_softlimit_reclaim_end, |
| 125 | |
| 126 | TP_PROTO(unsigned long nr_reclaimed), |
| 127 | |
| 128 | TP_ARGS(nr_reclaimed) |
| 129 | ) |
| 130 | |
| 131 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0)) |
| 132 | LTTNG_TRACEPOINT_EVENT_MAP(mm_shrink_slab_start, |
| 133 | |
| 134 | mm_vmscan_shrink_slab_start, |
| 135 | |
| 136 | TP_PROTO(struct shrinker *shr, struct shrink_control *sc, |
| 137 | long nr_objects_to_shrink, unsigned long pgs_scanned, |
| 138 | unsigned long lru_pgs, unsigned long cache_items, |
| 139 | unsigned long long delta, unsigned long total_scan), |
| 140 | |
| 141 | TP_ARGS(shr, sc, nr_objects_to_shrink, pgs_scanned, lru_pgs, |
| 142 | cache_items, delta, total_scan), |
| 143 | |
| 144 | TP_FIELDS( |
| 145 | ctf_integer(struct shrinker *, shr, shr) |
| 146 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0)) |
| 147 | ctf_integer(void *, shrink, shr->scan_objects) |
| 148 | #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0)) */ |
| 149 | ctf_integer(void *, shrink, shr->shrink) |
| 150 | #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0)) */ |
| 151 | ctf_integer(long, nr_objects_to_shrink, nr_objects_to_shrink) |
| 152 | ctf_integer(gfp_t, gfp_flags, sc->gfp_mask) |
| 153 | ctf_integer(unsigned long, pgs_scanned, pgs_scanned) |
| 154 | ctf_integer(unsigned long, lru_pgs, lru_pgs) |
| 155 | ctf_integer(unsigned long, cache_items, cache_items) |
| 156 | ctf_integer(unsigned long long, delta, delta) |
| 157 | ctf_integer(unsigned long, total_scan, total_scan) |
| 158 | ) |
| 159 | ) |
| 160 | |
| 161 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,16,0)) |
| 162 | LTTNG_TRACEPOINT_EVENT_MAP(mm_shrink_slab_end, |
| 163 | |
| 164 | mm_vmscan_shrink_slab_end, |
| 165 | |
| 166 | TP_PROTO(struct shrinker *shr, int nid, int shrinker_retval, |
| 167 | long unused_scan_cnt, long new_scan_cnt, long total_scan), |
| 168 | |
| 169 | TP_ARGS(shr, nid, shrinker_retval, unused_scan_cnt, new_scan_cnt, |
| 170 | total_scan), |
| 171 | |
| 172 | TP_FIELDS( |
| 173 | ctf_integer(struct shrinker *, shr, shr) |
| 174 | ctf_integer(int, nid, nid) |
| 175 | ctf_integer(void *, shrink, shr->scan_objects) |
| 176 | ctf_integer(long, unused_scan, unused_scan_cnt) |
| 177 | ctf_integer(long, new_scan, new_scan_cnt) |
| 178 | ctf_integer(int, retval, shrinker_retval) |
| 179 | ctf_integer(long, total_scan, total_scan) |
| 180 | ) |
| 181 | ) |
| 182 | #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,16,0)) */ |
| 183 | LTTNG_TRACEPOINT_EVENT_MAP(mm_shrink_slab_end, |
| 184 | |
| 185 | mm_vmscan_shrink_slab_end, |
| 186 | |
| 187 | TP_PROTO(struct shrinker *shr, int shrinker_retval, |
| 188 | long unused_scan_cnt, long new_scan_cnt), |
| 189 | |
| 190 | TP_ARGS(shr, shrinker_retval, unused_scan_cnt, new_scan_cnt), |
| 191 | |
| 192 | TP_FIELDS( |
| 193 | ctf_integer(struct shrinker *, shr, shr) |
| 194 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0)) |
| 195 | ctf_integer(void *, shrink, shr->scan_objects) |
| 196 | #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0)) */ |
| 197 | ctf_integer(void *, shrink, shr->shrink) |
| 198 | #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0)) */ |
| 199 | ctf_integer(long, unused_scan, unused_scan_cnt) |
| 200 | ctf_integer(long, new_scan, new_scan_cnt) |
| 201 | ctf_integer(int, retval, shrinker_retval) |
| 202 | ctf_integer(long, total_scan, new_scan_cnt - unused_scan_cnt) |
| 203 | ) |
| 204 | ) |
| 205 | #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,16,0)) */ |
| 206 | #endif |
| 207 | |
| 208 | LTTNG_TRACEPOINT_EVENT_CLASS(mm_vmscan_lru_isolate_template, |
| 209 | |
| 210 | TP_PROTO(int order, |
| 211 | unsigned long nr_requested, |
| 212 | unsigned long nr_scanned, |
| 213 | unsigned long nr_taken, |
| 214 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0)) |
| 215 | unsigned long nr_lumpy_taken, |
| 216 | unsigned long nr_lumpy_dirty, |
| 217 | unsigned long nr_lumpy_failed, |
| 218 | #endif |
| 219 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0)) |
| 220 | isolate_mode_t isolate_mode |
| 221 | #else |
| 222 | isolate_mode_t isolate_mode, |
| 223 | int file |
| 224 | #endif |
| 225 | ), |
| 226 | |
| 227 | TP_ARGS(order, nr_requested, nr_scanned, nr_taken, |
| 228 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0)) |
| 229 | nr_lumpy_taken, nr_lumpy_dirty, nr_lumpy_failed, |
| 230 | #endif |
| 231 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0)) |
| 232 | isolate_mode |
| 233 | #else |
| 234 | isolate_mode, file |
| 235 | #endif |
| 236 | ), |
| 237 | |
| 238 | |
| 239 | TP_FIELDS( |
| 240 | ctf_integer(int, order, order) |
| 241 | ctf_integer(unsigned long, nr_requested, nr_requested) |
| 242 | ctf_integer(unsigned long, nr_scanned, nr_scanned) |
| 243 | ctf_integer(unsigned long, nr_taken, nr_taken) |
| 244 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0)) |
| 245 | ctf_integer(unsigned long, nr_lumpy_taken, nr_lumpy_taken) |
| 246 | ctf_integer(unsigned long, nr_lumpy_dirty, nr_lumpy_dirty) |
| 247 | ctf_integer(unsigned long, nr_lumpy_failed, nr_lumpy_failed) |
| 248 | #endif |
| 249 | ctf_integer(isolate_mode_t, isolate_mode, isolate_mode) |
| 250 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0)) |
| 251 | ctf_integer(int, file, file) |
| 252 | #endif |
| 253 | ) |
| 254 | ) |
| 255 | |
| 256 | LTTNG_TRACEPOINT_EVENT_INSTANCE(mm_vmscan_lru_isolate_template, mm_vmscan_lru_isolate, |
| 257 | |
| 258 | TP_PROTO(int order, |
| 259 | unsigned long nr_requested, |
| 260 | unsigned long nr_scanned, |
| 261 | unsigned long nr_taken, |
| 262 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0)) |
| 263 | unsigned long nr_lumpy_taken, |
| 264 | unsigned long nr_lumpy_dirty, |
| 265 | unsigned long nr_lumpy_failed, |
| 266 | #endif |
| 267 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0)) |
| 268 | isolate_mode_t isolate_mode |
| 269 | #else |
| 270 | isolate_mode_t isolate_mode, |
| 271 | int file |
| 272 | #endif |
| 273 | ), |
| 274 | |
| 275 | TP_ARGS(order, nr_requested, nr_scanned, nr_taken, |
| 276 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0)) |
| 277 | nr_lumpy_taken, nr_lumpy_dirty, nr_lumpy_failed, |
| 278 | #endif |
| 279 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0)) |
| 280 | isolate_mode |
| 281 | #else |
| 282 | isolate_mode, file |
| 283 | #endif |
| 284 | ) |
| 285 | |
| 286 | ) |
| 287 | |
| 288 | LTTNG_TRACEPOINT_EVENT_INSTANCE(mm_vmscan_lru_isolate_template, mm_vmscan_memcg_isolate, |
| 289 | |
| 290 | TP_PROTO(int order, |
| 291 | unsigned long nr_requested, |
| 292 | unsigned long nr_scanned, |
| 293 | unsigned long nr_taken, |
| 294 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0)) |
| 295 | unsigned long nr_lumpy_taken, |
| 296 | unsigned long nr_lumpy_dirty, |
| 297 | unsigned long nr_lumpy_failed, |
| 298 | #endif |
| 299 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0)) |
| 300 | isolate_mode_t isolate_mode |
| 301 | #else |
| 302 | isolate_mode_t isolate_mode, |
| 303 | int file |
| 304 | #endif |
| 305 | ), |
| 306 | |
| 307 | TP_ARGS(order, nr_requested, nr_scanned, nr_taken, |
| 308 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0)) |
| 309 | nr_lumpy_taken, nr_lumpy_dirty, nr_lumpy_failed, |
| 310 | #endif |
| 311 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0)) |
| 312 | isolate_mode |
| 313 | #else |
| 314 | isolate_mode, file |
| 315 | #endif |
| 316 | ) |
| 317 | ) |
| 318 | |
| 319 | LTTNG_TRACEPOINT_EVENT(mm_vmscan_writepage, |
| 320 | |
| 321 | TP_PROTO(struct page *page, |
| 322 | int reclaim_flags), |
| 323 | |
| 324 | TP_ARGS(page, reclaim_flags), |
| 325 | |
| 326 | TP_FIELDS( |
| 327 | ctf_integer(struct page *, page, page) |
| 328 | ctf_integer(int, reclaim_flags, reclaim_flags) |
| 329 | ) |
| 330 | ) |
| 331 | |
| 332 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) |
| 333 | LTTNG_TRACEPOINT_EVENT(mm_vmscan_lru_shrink_inactive, |
| 334 | |
| 335 | TP_PROTO(int nid, int zid, |
| 336 | unsigned long nr_scanned, unsigned long nr_reclaimed, |
| 337 | int priority, int reclaim_flags), |
| 338 | |
| 339 | TP_ARGS(nid, zid, nr_scanned, nr_reclaimed, priority, reclaim_flags), |
| 340 | |
| 341 | TP_FIELDS( |
| 342 | ctf_integer(int, nid, nid) |
| 343 | ctf_integer(int, zid, zid) |
| 344 | ctf_integer(unsigned long, nr_scanned, nr_scanned) |
| 345 | ctf_integer(unsigned long, nr_reclaimed, nr_reclaimed) |
| 346 | ctf_integer(int, priority, priority) |
| 347 | ctf_integer(int, reclaim_flags, reclaim_flags) |
| 348 | ) |
| 349 | ) |
| 350 | #endif |
| 351 | |
| 352 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0)) |
| 353 | LTTNG_TRACEPOINT_EVENT_MAP(replace_swap_token, |
| 354 | |
| 355 | mm_vmscan_replace_swap_token, |
| 356 | |
| 357 | TP_PROTO(struct mm_struct *old_mm, |
| 358 | struct mm_struct *new_mm), |
| 359 | |
| 360 | TP_ARGS(old_mm, new_mm), |
| 361 | |
| 362 | TP_FIELDS( |
| 363 | ctf_integer(struct mm_struct *, old_mm, old_mm) |
| 364 | ctf_integer(unsigned int, old_prio, old_mm ? old_mm->token_priority : 0) |
| 365 | ctf_integer(struct mm_struct *, new_mm, new_mm) |
| 366 | ctf_integer(unsigned int, new_prio, new_mm->token_priority) |
| 367 | ) |
| 368 | ) |
| 369 | |
| 370 | LTTNG_TRACEPOINT_EVENT_CLASS(mm_vmscan_put_swap_token_template, |
| 371 | TP_PROTO(struct mm_struct *swap_token_mm), |
| 372 | |
| 373 | TP_ARGS(swap_token_mm), |
| 374 | |
| 375 | TP_FIELDS( |
| 376 | ctf_integer(struct mm_struct*, swap_token_mm, swap_token_mm) |
| 377 | ) |
| 378 | ) |
| 379 | |
| 380 | LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(mm_vmscan_put_swap_token_template, put_swap_token, |
| 381 | |
| 382 | mm_vmscan_put_swap_token, |
| 383 | |
| 384 | TP_PROTO(struct mm_struct *swap_token_mm), |
| 385 | TP_ARGS(swap_token_mm) |
| 386 | ) |
| 387 | |
| 388 | LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(mm_vmscan_put_swap_token_template, disable_swap_token, |
| 389 | |
| 390 | mm_vmscan_disable_swap_token, |
| 391 | |
| 392 | TP_PROTO(struct mm_struct *swap_token_mm), |
| 393 | TP_ARGS(swap_token_mm) |
| 394 | ) |
| 395 | |
| 396 | LTTNG_TRACEPOINT_EVENT_MAP(update_swap_token_priority, |
| 397 | |
| 398 | mm_vmscan_update_swap_token_priority, |
| 399 | |
| 400 | TP_PROTO(struct mm_struct *mm, |
| 401 | unsigned int old_prio, |
| 402 | struct mm_struct *swap_token_mm), |
| 403 | |
| 404 | TP_ARGS(mm, old_prio, swap_token_mm), |
| 405 | |
| 406 | TP_FIELDS( |
| 407 | ctf_integer(struct mm_struct*, mm, mm) |
| 408 | ctf_integer(unsigned int, old_prio, old_prio) |
| 409 | ctf_integer(unsigned int, new_prio, mm->token_priority) |
| 410 | ctf_integer(struct mm_struct*, swap_token_mm, swap_token_mm) |
| 411 | ctf_integer(unsigned int, swap_token_prio, swap_token_mm ? swap_token_mm->token_priority : 0) |
| 412 | ) |
| 413 | ) |
| 414 | #endif |
| 415 | |
| 416 | #endif /* LTTNG_TRACE_MM_VMSCAN_H */ |
| 417 | |
| 418 | /* This part must be outside protection */ |
| 419 | #include "../../../probes/define_trace.h" |