| 1 | #undef TRACE_SYSTEM |
| 2 | #define TRACE_SYSTEM vmscan |
| 3 | |
| 4 | #if !defined(_TRACE_VMSCAN_H) || defined(TRACE_HEADER_MULTI_READ) |
| 5 | #define _TRACE_VMSCAN_H |
| 6 | |
| 7 | #include <linux/types.h> |
| 8 | #include <linux/tracepoint.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(2,6,37)) |
| 23 | #define show_reclaim_flags(flags) \ |
| 24 | (flags) ? __print_flags(flags, "|", \ |
| 25 | {RECLAIM_WB_ANON, "RECLAIM_WB_ANON"}, \ |
| 26 | {RECLAIM_WB_FILE, "RECLAIM_WB_FILE"}, \ |
| 27 | {RECLAIM_WB_MIXED, "RECLAIM_WB_MIXED"}, \ |
| 28 | {RECLAIM_WB_SYNC, "RECLAIM_WB_SYNC"}, \ |
| 29 | {RECLAIM_WB_ASYNC, "RECLAIM_WB_ASYNC"} \ |
| 30 | ) : "RECLAIM_WB_NONE" |
| 31 | #else |
| 32 | #define show_reclaim_flags(flags) \ |
| 33 | (flags) ? __print_flags(flags, "|", \ |
| 34 | {RECLAIM_WB_ANON, "RECLAIM_WB_ANON"}, \ |
| 35 | {RECLAIM_WB_FILE, "RECLAIM_WB_FILE"}, \ |
| 36 | {RECLAIM_WB_SYNC, "RECLAIM_WB_SYNC"}, \ |
| 37 | {RECLAIM_WB_ASYNC, "RECLAIM_WB_ASYNC"} \ |
| 38 | ) : "RECLAIM_WB_NONE" |
| 39 | #endif |
| 40 | |
| 41 | #if ((LINUX_VERSION_CODE <= KERNEL_VERSION(3,0,38)) || \ |
| 42 | LTTNG_KERNEL_RANGE(3,1,0, 3,2,0)) |
| 43 | typedef int isolate_mode_t; |
| 44 | #endif |
| 45 | |
| 46 | #endif |
| 47 | |
| 48 | TRACE_EVENT(mm_vmscan_kswapd_sleep, |
| 49 | |
| 50 | TP_PROTO(int nid), |
| 51 | |
| 52 | TP_ARGS(nid), |
| 53 | |
| 54 | TP_STRUCT__entry( |
| 55 | __field( int, nid ) |
| 56 | ), |
| 57 | |
| 58 | TP_fast_assign( |
| 59 | tp_assign(nid, nid) |
| 60 | ), |
| 61 | |
| 62 | TP_printk("nid=%d", __entry->nid) |
| 63 | ) |
| 64 | |
| 65 | TRACE_EVENT(mm_vmscan_kswapd_wake, |
| 66 | |
| 67 | TP_PROTO(int nid, int order), |
| 68 | |
| 69 | TP_ARGS(nid, order), |
| 70 | |
| 71 | TP_STRUCT__entry( |
| 72 | __field( int, nid ) |
| 73 | __field( int, order ) |
| 74 | ), |
| 75 | |
| 76 | TP_fast_assign( |
| 77 | tp_assign(nid, nid) |
| 78 | tp_assign(order, order) |
| 79 | ), |
| 80 | |
| 81 | TP_printk("nid=%d order=%d", __entry->nid, __entry->order) |
| 82 | ) |
| 83 | |
| 84 | TRACE_EVENT(mm_vmscan_wakeup_kswapd, |
| 85 | |
| 86 | TP_PROTO(int nid, int zid, int order), |
| 87 | |
| 88 | TP_ARGS(nid, zid, order), |
| 89 | |
| 90 | TP_STRUCT__entry( |
| 91 | __field( int, nid ) |
| 92 | __field( int, zid ) |
| 93 | __field( int, order ) |
| 94 | ), |
| 95 | |
| 96 | TP_fast_assign( |
| 97 | tp_assign(nid, nid) |
| 98 | tp_assign(zid, zid) |
| 99 | tp_assign(order, order) |
| 100 | ), |
| 101 | |
| 102 | TP_printk("nid=%d zid=%d order=%d", |
| 103 | __entry->nid, |
| 104 | __entry->zid, |
| 105 | __entry->order) |
| 106 | ) |
| 107 | |
| 108 | DECLARE_EVENT_CLASS(mm_vmscan_direct_reclaim_begin_template, |
| 109 | |
| 110 | TP_PROTO(int order, int may_writepage, gfp_t gfp_flags), |
| 111 | |
| 112 | TP_ARGS(order, may_writepage, gfp_flags), |
| 113 | |
| 114 | TP_STRUCT__entry( |
| 115 | __field( int, order ) |
| 116 | __field( int, may_writepage ) |
| 117 | __field( gfp_t, gfp_flags ) |
| 118 | ), |
| 119 | |
| 120 | TP_fast_assign( |
| 121 | tp_assign(order, order) |
| 122 | tp_assign(may_writepage, may_writepage) |
| 123 | tp_assign(gfp_flags, gfp_flags) |
| 124 | ), |
| 125 | |
| 126 | TP_printk("order=%d may_writepage=%d gfp_flags=%s", |
| 127 | __entry->order, |
| 128 | __entry->may_writepage, |
| 129 | show_gfp_flags(__entry->gfp_flags)) |
| 130 | ) |
| 131 | |
| 132 | DEFINE_EVENT(mm_vmscan_direct_reclaim_begin_template, mm_vmscan_direct_reclaim_begin, |
| 133 | |
| 134 | TP_PROTO(int order, int may_writepage, gfp_t gfp_flags), |
| 135 | |
| 136 | TP_ARGS(order, may_writepage, gfp_flags) |
| 137 | ) |
| 138 | |
| 139 | DEFINE_EVENT(mm_vmscan_direct_reclaim_begin_template, mm_vmscan_memcg_reclaim_begin, |
| 140 | |
| 141 | TP_PROTO(int order, int may_writepage, gfp_t gfp_flags), |
| 142 | |
| 143 | TP_ARGS(order, may_writepage, gfp_flags) |
| 144 | ) |
| 145 | |
| 146 | DEFINE_EVENT(mm_vmscan_direct_reclaim_begin_template, mm_vmscan_memcg_softlimit_reclaim_begin, |
| 147 | |
| 148 | TP_PROTO(int order, int may_writepage, gfp_t gfp_flags), |
| 149 | |
| 150 | TP_ARGS(order, may_writepage, gfp_flags) |
| 151 | ) |
| 152 | |
| 153 | DECLARE_EVENT_CLASS(mm_vmscan_direct_reclaim_end_template, |
| 154 | |
| 155 | TP_PROTO(unsigned long nr_reclaimed), |
| 156 | |
| 157 | TP_ARGS(nr_reclaimed), |
| 158 | |
| 159 | TP_STRUCT__entry( |
| 160 | __field( unsigned long, nr_reclaimed ) |
| 161 | ), |
| 162 | |
| 163 | TP_fast_assign( |
| 164 | tp_assign(nr_reclaimed, nr_reclaimed) |
| 165 | ), |
| 166 | |
| 167 | TP_printk("nr_reclaimed=%lu", __entry->nr_reclaimed) |
| 168 | ) |
| 169 | |
| 170 | DEFINE_EVENT(mm_vmscan_direct_reclaim_end_template, mm_vmscan_direct_reclaim_end, |
| 171 | |
| 172 | TP_PROTO(unsigned long nr_reclaimed), |
| 173 | |
| 174 | TP_ARGS(nr_reclaimed) |
| 175 | ) |
| 176 | |
| 177 | DEFINE_EVENT(mm_vmscan_direct_reclaim_end_template, mm_vmscan_memcg_reclaim_end, |
| 178 | |
| 179 | TP_PROTO(unsigned long nr_reclaimed), |
| 180 | |
| 181 | TP_ARGS(nr_reclaimed) |
| 182 | ) |
| 183 | |
| 184 | DEFINE_EVENT(mm_vmscan_direct_reclaim_end_template, mm_vmscan_memcg_softlimit_reclaim_end, |
| 185 | |
| 186 | TP_PROTO(unsigned long nr_reclaimed), |
| 187 | |
| 188 | TP_ARGS(nr_reclaimed) |
| 189 | ) |
| 190 | |
| 191 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0)) |
| 192 | TRACE_EVENT(mm_shrink_slab_start, |
| 193 | TP_PROTO(struct shrinker *shr, struct shrink_control *sc, |
| 194 | long nr_objects_to_shrink, unsigned long pgs_scanned, |
| 195 | unsigned long lru_pgs, unsigned long cache_items, |
| 196 | unsigned long long delta, unsigned long total_scan), |
| 197 | |
| 198 | TP_ARGS(shr, sc, nr_objects_to_shrink, pgs_scanned, lru_pgs, |
| 199 | cache_items, delta, total_scan), |
| 200 | |
| 201 | TP_STRUCT__entry( |
| 202 | __field(struct shrinker *, shr) |
| 203 | __field(void *, shrink) |
| 204 | __field(long, nr_objects_to_shrink) |
| 205 | __field(gfp_t, gfp_flags) |
| 206 | __field(unsigned long, pgs_scanned) |
| 207 | __field(unsigned long, lru_pgs) |
| 208 | __field(unsigned long, cache_items) |
| 209 | __field(unsigned long long, delta) |
| 210 | __field(unsigned long, total_scan) |
| 211 | ), |
| 212 | |
| 213 | TP_fast_assign( |
| 214 | tp_assign(shr,shr) |
| 215 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0)) |
| 216 | tp_assign(shrink, shr->scan_objects) |
| 217 | #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0)) */ |
| 218 | tp_assign(shrink, shr->shrink) |
| 219 | #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0)) */ |
| 220 | tp_assign(nr_objects_to_shrink, nr_objects_to_shrink) |
| 221 | tp_assign(gfp_flags, sc->gfp_mask) |
| 222 | tp_assign(pgs_scanned, pgs_scanned) |
| 223 | tp_assign(lru_pgs, lru_pgs) |
| 224 | tp_assign(cache_items, cache_items) |
| 225 | tp_assign(delta, delta) |
| 226 | tp_assign(total_scan, total_scan) |
| 227 | ), |
| 228 | |
| 229 | TP_printk("%pF %p: objects to shrink %ld gfp_flags %s pgs_scanned %ld lru_pgs %ld cache items %ld delta %lld total_scan %ld", |
| 230 | __entry->shrink, |
| 231 | __entry->shr, |
| 232 | __entry->nr_objects_to_shrink, |
| 233 | show_gfp_flags(__entry->gfp_flags), |
| 234 | __entry->pgs_scanned, |
| 235 | __entry->lru_pgs, |
| 236 | __entry->cache_items, |
| 237 | __entry->delta, |
| 238 | __entry->total_scan) |
| 239 | ) |
| 240 | |
| 241 | TRACE_EVENT(mm_shrink_slab_end, |
| 242 | TP_PROTO(struct shrinker *shr, int shrinker_retval, |
| 243 | long unused_scan_cnt, long new_scan_cnt), |
| 244 | |
| 245 | TP_ARGS(shr, shrinker_retval, unused_scan_cnt, new_scan_cnt), |
| 246 | |
| 247 | TP_STRUCT__entry( |
| 248 | __field(struct shrinker *, shr) |
| 249 | __field(void *, shrink) |
| 250 | __field(long, unused_scan) |
| 251 | __field(long, new_scan) |
| 252 | __field(int, retval) |
| 253 | __field(long, total_scan) |
| 254 | ), |
| 255 | |
| 256 | TP_fast_assign( |
| 257 | tp_assign(shr, shr) |
| 258 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0)) |
| 259 | tp_assign(shrink, shr->scan_objects) |
| 260 | #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0)) */ |
| 261 | tp_assign(shrink, shr->shrink) |
| 262 | #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0)) */ |
| 263 | tp_assign(unused_scan, unused_scan_cnt) |
| 264 | tp_assign(new_scan, new_scan_cnt) |
| 265 | tp_assign(retval, shrinker_retval) |
| 266 | tp_assign(total_scan, new_scan_cnt - unused_scan_cnt) |
| 267 | ), |
| 268 | |
| 269 | TP_printk("%pF %p: unused scan count %ld new scan count %ld total_scan %ld last shrinker return val %d", |
| 270 | __entry->shrink, |
| 271 | __entry->shr, |
| 272 | __entry->unused_scan, |
| 273 | __entry->new_scan, |
| 274 | __entry->total_scan, |
| 275 | __entry->retval) |
| 276 | ) |
| 277 | #endif |
| 278 | |
| 279 | DECLARE_EVENT_CLASS(mm_vmscan_lru_isolate_template, |
| 280 | |
| 281 | TP_PROTO(int order, |
| 282 | unsigned long nr_requested, |
| 283 | unsigned long nr_scanned, |
| 284 | unsigned long nr_taken, |
| 285 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0)) |
| 286 | unsigned long nr_lumpy_taken, |
| 287 | unsigned long nr_lumpy_dirty, |
| 288 | unsigned long nr_lumpy_failed, |
| 289 | #endif |
| 290 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0)) |
| 291 | isolate_mode_t isolate_mode |
| 292 | #else |
| 293 | isolate_mode_t isolate_mode, |
| 294 | int file |
| 295 | #endif |
| 296 | ), |
| 297 | |
| 298 | TP_ARGS(order, nr_requested, nr_scanned, nr_taken, |
| 299 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0)) |
| 300 | nr_lumpy_taken, nr_lumpy_dirty, nr_lumpy_failed, |
| 301 | #endif |
| 302 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0)) |
| 303 | isolate_mode |
| 304 | #else |
| 305 | isolate_mode, file |
| 306 | #endif |
| 307 | ), |
| 308 | |
| 309 | |
| 310 | TP_STRUCT__entry( |
| 311 | __field(int, order) |
| 312 | __field(unsigned long, nr_requested) |
| 313 | __field(unsigned long, nr_scanned) |
| 314 | __field(unsigned long, nr_taken) |
| 315 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0)) |
| 316 | __field(unsigned long, nr_lumpy_taken) |
| 317 | __field(unsigned long, nr_lumpy_dirty) |
| 318 | __field(unsigned long, nr_lumpy_failed) |
| 319 | #endif |
| 320 | __field(isolate_mode_t, isolate_mode) |
| 321 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0)) |
| 322 | __field(int, file) |
| 323 | #endif |
| 324 | ), |
| 325 | |
| 326 | TP_fast_assign( |
| 327 | tp_assign(order, order) |
| 328 | tp_assign(nr_requested, nr_requested) |
| 329 | tp_assign(nr_scanned, nr_scanned) |
| 330 | tp_assign(nr_taken, nr_taken) |
| 331 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0)) |
| 332 | tp_assign(nr_lumpy_taken, nr_lumpy_taken) |
| 333 | tp_assign(nr_lumpy_dirty, nr_lumpy_dirty) |
| 334 | tp_assign(nr_lumpy_failed, nr_lumpy_failed) |
| 335 | #endif |
| 336 | tp_assign(isolate_mode, isolate_mode) |
| 337 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0)) |
| 338 | tp_assign(file, file) |
| 339 | #endif |
| 340 | ), |
| 341 | |
| 342 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0)) |
| 343 | TP_printk("isolate_mode=%d order=%d nr_requested=%lu nr_scanned=%lu nr_taken=%lu contig_taken=%lu contig_dirty=%lu contig_failed=%lu", |
| 344 | __entry->isolate_mode, |
| 345 | __entry->order, |
| 346 | __entry->nr_requested, |
| 347 | __entry->nr_scanned, |
| 348 | __entry->nr_taken, |
| 349 | __entry->nr_lumpy_taken, |
| 350 | __entry->nr_lumpy_dirty, |
| 351 | __entry->nr_lumpy_failed) |
| 352 | #elif (LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0)) |
| 353 | TP_printk("isolate_mode=%d order=%d nr_requested=%lu nr_scanned=%lu nr_taken=%lu contig_taken=%lu contig_dirty=%lu contig_failed=%lu file=%d", |
| 354 | __entry->isolate_mode, |
| 355 | __entry->order, |
| 356 | __entry->nr_requested, |
| 357 | __entry->nr_scanned, |
| 358 | __entry->nr_taken, |
| 359 | __entry->nr_lumpy_taken, |
| 360 | __entry->nr_lumpy_dirty, |
| 361 | __entry->nr_lumpy_failed, |
| 362 | __entry->file) |
| 363 | #else |
| 364 | TP_printk("isolate_mode=%d order=%d nr_requested=%lu nr_scanned=%lu nr_taken=%lu file=%d", |
| 365 | __entry->isolate_mode, |
| 366 | __entry->order, |
| 367 | __entry->nr_requested, |
| 368 | __entry->nr_scanned, |
| 369 | __entry->nr_taken, |
| 370 | __entry->file) |
| 371 | #endif |
| 372 | ) |
| 373 | |
| 374 | DEFINE_EVENT(mm_vmscan_lru_isolate_template, mm_vmscan_lru_isolate, |
| 375 | |
| 376 | TP_PROTO(int order, |
| 377 | unsigned long nr_requested, |
| 378 | unsigned long nr_scanned, |
| 379 | unsigned long nr_taken, |
| 380 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0)) |
| 381 | unsigned long nr_lumpy_taken, |
| 382 | unsigned long nr_lumpy_dirty, |
| 383 | unsigned long nr_lumpy_failed, |
| 384 | #endif |
| 385 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0)) |
| 386 | isolate_mode_t isolate_mode |
| 387 | #else |
| 388 | isolate_mode_t isolate_mode, |
| 389 | int file |
| 390 | #endif |
| 391 | ), |
| 392 | |
| 393 | TP_ARGS(order, nr_requested, nr_scanned, nr_taken, |
| 394 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0)) |
| 395 | nr_lumpy_taken, nr_lumpy_dirty, nr_lumpy_failed, |
| 396 | #endif |
| 397 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0)) |
| 398 | isolate_mode |
| 399 | #else |
| 400 | isolate_mode, file |
| 401 | #endif |
| 402 | ) |
| 403 | |
| 404 | ) |
| 405 | |
| 406 | DEFINE_EVENT(mm_vmscan_lru_isolate_template, mm_vmscan_memcg_isolate, |
| 407 | |
| 408 | TP_PROTO(int order, |
| 409 | unsigned long nr_requested, |
| 410 | unsigned long nr_scanned, |
| 411 | unsigned long nr_taken, |
| 412 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0)) |
| 413 | unsigned long nr_lumpy_taken, |
| 414 | unsigned long nr_lumpy_dirty, |
| 415 | unsigned long nr_lumpy_failed, |
| 416 | #endif |
| 417 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0)) |
| 418 | isolate_mode_t isolate_mode |
| 419 | #else |
| 420 | isolate_mode_t isolate_mode, |
| 421 | int file |
| 422 | #endif |
| 423 | ), |
| 424 | |
| 425 | TP_ARGS(order, nr_requested, nr_scanned, nr_taken, |
| 426 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0)) |
| 427 | nr_lumpy_taken, nr_lumpy_dirty, nr_lumpy_failed, |
| 428 | #endif |
| 429 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0)) |
| 430 | isolate_mode |
| 431 | #else |
| 432 | isolate_mode, file |
| 433 | #endif |
| 434 | ) |
| 435 | ) |
| 436 | |
| 437 | TRACE_EVENT(mm_vmscan_writepage, |
| 438 | |
| 439 | TP_PROTO(struct page *page, |
| 440 | int reclaim_flags), |
| 441 | |
| 442 | TP_ARGS(page, reclaim_flags), |
| 443 | |
| 444 | TP_STRUCT__entry( |
| 445 | __field(struct page *, page) |
| 446 | __field(int, reclaim_flags) |
| 447 | ), |
| 448 | |
| 449 | TP_fast_assign( |
| 450 | tp_assign(page, page) |
| 451 | tp_assign(reclaim_flags, reclaim_flags) |
| 452 | ), |
| 453 | |
| 454 | TP_printk("page=%p pfn=%lu flags=%s", |
| 455 | __entry->page, |
| 456 | page_to_pfn(__entry->page), |
| 457 | show_reclaim_flags(__entry->reclaim_flags)) |
| 458 | ) |
| 459 | |
| 460 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) |
| 461 | TRACE_EVENT(mm_vmscan_lru_shrink_inactive, |
| 462 | |
| 463 | TP_PROTO(int nid, int zid, |
| 464 | unsigned long nr_scanned, unsigned long nr_reclaimed, |
| 465 | int priority, int reclaim_flags), |
| 466 | |
| 467 | TP_ARGS(nid, zid, nr_scanned, nr_reclaimed, priority, reclaim_flags), |
| 468 | |
| 469 | TP_STRUCT__entry( |
| 470 | __field(int, nid) |
| 471 | __field(int, zid) |
| 472 | __field(unsigned long, nr_scanned) |
| 473 | __field(unsigned long, nr_reclaimed) |
| 474 | __field(int, priority) |
| 475 | __field(int, reclaim_flags) |
| 476 | ), |
| 477 | |
| 478 | TP_fast_assign( |
| 479 | tp_assign(nid, nid) |
| 480 | tp_assign(zid, zid) |
| 481 | tp_assign(nr_scanned, nr_scanned) |
| 482 | tp_assign(nr_reclaimed, nr_reclaimed) |
| 483 | tp_assign(priority, priority) |
| 484 | tp_assign(reclaim_flags, reclaim_flags) |
| 485 | ), |
| 486 | |
| 487 | TP_printk("nid=%d zid=%d nr_scanned=%ld nr_reclaimed=%ld priority=%d flags=%s", |
| 488 | __entry->nid, __entry->zid, |
| 489 | __entry->nr_scanned, __entry->nr_reclaimed, |
| 490 | __entry->priority, |
| 491 | show_reclaim_flags(__entry->reclaim_flags)) |
| 492 | ) |
| 493 | #endif |
| 494 | |
| 495 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0)) |
| 496 | TRACE_EVENT_MAP(replace_swap_token, |
| 497 | |
| 498 | mm_vmscan_replace_swap_token, |
| 499 | |
| 500 | TP_PROTO(struct mm_struct *old_mm, |
| 501 | struct mm_struct *new_mm), |
| 502 | |
| 503 | TP_ARGS(old_mm, new_mm), |
| 504 | |
| 505 | TP_STRUCT__entry( |
| 506 | __field(struct mm_struct*, old_mm) |
| 507 | __field(unsigned int, old_prio) |
| 508 | __field(struct mm_struct*, new_mm) |
| 509 | __field(unsigned int, new_prio) |
| 510 | ), |
| 511 | |
| 512 | TP_fast_assign( |
| 513 | tp_assign(old_mm, old_mm) |
| 514 | tp_assign(old_prio, old_mm ? old_mm->token_priority : 0) |
| 515 | tp_assign(new_mm, new_mm) |
| 516 | tp_assign(new_prio, new_mm->token_priority) |
| 517 | ), |
| 518 | |
| 519 | TP_printk("old_token_mm=%p old_prio=%u new_token_mm=%p new_prio=%u", |
| 520 | __entry->old_mm, __entry->old_prio, |
| 521 | __entry->new_mm, __entry->new_prio) |
| 522 | ) |
| 523 | |
| 524 | DECLARE_EVENT_CLASS(mm_vmscan_put_swap_token_template, |
| 525 | TP_PROTO(struct mm_struct *swap_token_mm), |
| 526 | |
| 527 | TP_ARGS(swap_token_mm), |
| 528 | |
| 529 | TP_STRUCT__entry( |
| 530 | __field(struct mm_struct*, swap_token_mm) |
| 531 | ), |
| 532 | |
| 533 | TP_fast_assign( |
| 534 | tp_assign(swap_token_mm, swap_token_mm) |
| 535 | ), |
| 536 | |
| 537 | TP_printk("token_mm=%p", __entry->swap_token_mm) |
| 538 | ) |
| 539 | |
| 540 | DEFINE_EVENT_MAP(mm_vmscan_put_swap_token_template, put_swap_token, |
| 541 | |
| 542 | mm_vmscan_put_swap_token, |
| 543 | |
| 544 | TP_PROTO(struct mm_struct *swap_token_mm), |
| 545 | TP_ARGS(swap_token_mm) |
| 546 | ) |
| 547 | |
| 548 | DEFINE_EVENT_CONDITION_MAP(mm_vmscan_put_swap_token_template, disable_swap_token, |
| 549 | |
| 550 | mm_vmscan_disable_swap_token, |
| 551 | |
| 552 | TP_PROTO(struct mm_struct *swap_token_mm), |
| 553 | TP_ARGS(swap_token_mm), |
| 554 | TP_CONDITION(swap_token_mm != NULL) |
| 555 | ) |
| 556 | |
| 557 | TRACE_EVENT_CONDITION_MAP(update_swap_token_priority, |
| 558 | |
| 559 | mm_vmscan_update_swap_token_priority, |
| 560 | |
| 561 | TP_PROTO(struct mm_struct *mm, |
| 562 | unsigned int old_prio, |
| 563 | struct mm_struct *swap_token_mm), |
| 564 | |
| 565 | TP_ARGS(mm, old_prio, swap_token_mm), |
| 566 | |
| 567 | TP_CONDITION(mm->token_priority != old_prio), |
| 568 | |
| 569 | TP_STRUCT__entry( |
| 570 | __field(struct mm_struct*, mm) |
| 571 | __field(unsigned int, old_prio) |
| 572 | __field(unsigned int, new_prio) |
| 573 | __field(struct mm_struct*, swap_token_mm) |
| 574 | __field(unsigned int, swap_token_prio) |
| 575 | ), |
| 576 | |
| 577 | TP_fast_assign( |
| 578 | tp_assign(mm, mm) |
| 579 | tp_assign(old_prio, old_prio) |
| 580 | tp_assign(new_prio, mm->token_priority) |
| 581 | tp_assign(swap_token_mm, swap_token_mm) |
| 582 | tp_assign(swap_token_prio, swap_token_mm ? swap_token_mm->token_priority : 0) |
| 583 | ), |
| 584 | |
| 585 | TP_printk("mm=%p old_prio=%u new_prio=%u swap_token_mm=%p token_prio=%u", |
| 586 | __entry->mm, __entry->old_prio, __entry->new_prio, |
| 587 | __entry->swap_token_mm, __entry->swap_token_prio) |
| 588 | ) |
| 589 | #endif |
| 590 | |
| 591 | #endif /* _TRACE_VMSCAN_H */ |
| 592 | |
| 593 | /* This part must be outside protection */ |
| 594 | #include "../../../probes/define_trace.h" |