| 1 | #undef TRACE_SYSTEM |
| 2 | #define TRACE_SYSTEM compaction |
| 3 | |
| 4 | #if !defined(LTTNG_TRACE_COMPACTION_H) || defined(TRACE_HEADER_MULTI_READ) |
| 5 | #define LTTNG_TRACE_COMPACTION_H |
| 6 | |
| 7 | #include "../../../probes/lttng-tracepoint-event.h" |
| 8 | #include <linux/types.h> |
| 9 | #include <linux/version.h> |
| 10 | #include <trace/events/gfpflags.h> |
| 11 | |
| 12 | LTTNG_TRACEPOINT_EVENT_CLASS(mm_compaction_isolate_template, |
| 13 | |
| 14 | TP_PROTO(unsigned long nr_scanned, |
| 15 | unsigned long nr_taken), |
| 16 | |
| 17 | TP_ARGS(nr_scanned, nr_taken), |
| 18 | |
| 19 | TP_STRUCT__entry( |
| 20 | __field(unsigned long, nr_scanned) |
| 21 | __field(unsigned long, nr_taken) |
| 22 | ), |
| 23 | |
| 24 | TP_fast_assign( |
| 25 | tp_assign(nr_scanned, nr_scanned) |
| 26 | tp_assign(nr_taken, nr_taken) |
| 27 | ), |
| 28 | |
| 29 | TP_printk("nr_scanned=%lu nr_taken=%lu", |
| 30 | __entry->nr_scanned, |
| 31 | __entry->nr_taken) |
| 32 | ) |
| 33 | |
| 34 | LTTNG_TRACEPOINT_EVENT_INSTANCE(mm_compaction_isolate_template, mm_compaction_isolate_migratepages, |
| 35 | |
| 36 | TP_PROTO(unsigned long nr_scanned, |
| 37 | unsigned long nr_taken), |
| 38 | |
| 39 | TP_ARGS(nr_scanned, nr_taken) |
| 40 | ) |
| 41 | |
| 42 | LTTNG_TRACEPOINT_EVENT_INSTANCE(mm_compaction_isolate_template, mm_compaction_isolate_freepages, |
| 43 | TP_PROTO(unsigned long nr_scanned, |
| 44 | unsigned long nr_taken), |
| 45 | |
| 46 | TP_ARGS(nr_scanned, nr_taken) |
| 47 | ) |
| 48 | |
| 49 | #if LTTNG_KERNEL_RANGE(3,14,25, 3,15,0) || \ |
| 50 | (LINUX_VERSION_CODE >= KERNEL_VERSION(3,16,0)) |
| 51 | LTTNG_TRACEPOINT_EVENT(mm_compaction_migratepages, |
| 52 | |
| 53 | TP_PROTO(unsigned long nr_all, |
| 54 | int migrate_rc, |
| 55 | struct list_head *migratepages), |
| 56 | |
| 57 | TP_ARGS(nr_all, migrate_rc, migratepages), |
| 58 | |
| 59 | TP_STRUCT__entry( |
| 60 | __field(unsigned long, nr_migrated) |
| 61 | __field(unsigned long, nr_failed) |
| 62 | ), |
| 63 | |
| 64 | TP_fast_assign( |
| 65 | tp_assign(nr_migrated, |
| 66 | nr_all - |
| 67 | (migrate_rc >= 0 ? migrate_rc : |
| 68 | ({ |
| 69 | unsigned long nr_failed = 0; |
| 70 | struct list_head *page_lru; |
| 71 | |
| 72 | list_for_each(page_lru, migratepages) |
| 73 | nr_failed++; |
| 74 | nr_failed; |
| 75 | }))) |
| 76 | tp_assign(nr_failed, |
| 77 | ({ |
| 78 | unsigned long nr_failed = 0; |
| 79 | struct list_head *page_lru; |
| 80 | |
| 81 | list_for_each(page_lru, migratepages) |
| 82 | nr_failed++; |
| 83 | nr_failed; |
| 84 | })) |
| 85 | ), |
| 86 | |
| 87 | TP_printk("nr_migrated=%lu nr_failed=%lu", |
| 88 | __entry->nr_migrated, |
| 89 | __entry->nr_failed) |
| 90 | ) |
| 91 | #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,16,0)) */ |
| 92 | LTTNG_TRACEPOINT_EVENT(mm_compaction_migratepages, |
| 93 | |
| 94 | TP_PROTO(unsigned long nr_migrated, |
| 95 | unsigned long nr_failed), |
| 96 | |
| 97 | TP_ARGS(nr_migrated, nr_failed), |
| 98 | |
| 99 | TP_STRUCT__entry( |
| 100 | __field(unsigned long, nr_migrated) |
| 101 | __field(unsigned long, nr_failed) |
| 102 | ), |
| 103 | |
| 104 | TP_fast_assign( |
| 105 | tp_assign(nr_migrated, nr_migrated) |
| 106 | tp_assign(nr_failed, nr_failed) |
| 107 | ), |
| 108 | |
| 109 | TP_printk("nr_migrated=%lu nr_failed=%lu", |
| 110 | __entry->nr_migrated, |
| 111 | __entry->nr_failed) |
| 112 | ) |
| 113 | #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,16,0)) */ |
| 114 | |
| 115 | #endif /* LTTNG_TRACE_COMPACTION_H */ |
| 116 | |
| 117 | /* This part must be outside protection */ |
| 118 | #include "../../../probes/define_trace.h" |