| 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 | |
| 11 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(4,0,0) |
| 12 | |
| 13 | LTTNG_TRACEPOINT_EVENT_CLASS(compaction_isolate_template, |
| 14 | |
| 15 | TP_PROTO(unsigned long start_pfn, |
| 16 | unsigned long end_pfn, |
| 17 | unsigned long nr_scanned, |
| 18 | unsigned long nr_taken), |
| 19 | |
| 20 | TP_ARGS(start_pfn, end_pfn, nr_scanned, nr_taken), |
| 21 | |
| 22 | TP_FIELDS( |
| 23 | ctf_integer(unsigned long, start_pfn, start_pfn) |
| 24 | ctf_integer(unsigned long, end_pfn, end_pfn) |
| 25 | ctf_integer(unsigned long, nr_scanned, nr_scanned) |
| 26 | ctf_integer(unsigned long, nr_taken, nr_taken) |
| 27 | ) |
| 28 | ) |
| 29 | |
| 30 | LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(compaction_isolate_template, |
| 31 | |
| 32 | mm_compaction_isolate_migratepages, |
| 33 | |
| 34 | compaction_isolate_migratepages, |
| 35 | |
| 36 | TP_PROTO(unsigned long start_pfn, |
| 37 | unsigned long end_pfn, |
| 38 | unsigned long nr_scanned, |
| 39 | unsigned long nr_taken), |
| 40 | |
| 41 | TP_ARGS(start_pfn, end_pfn, nr_scanned, nr_taken) |
| 42 | ) |
| 43 | |
| 44 | LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(compaction_isolate_template, |
| 45 | |
| 46 | mm_compaction_isolate_freepages, |
| 47 | |
| 48 | compaction_isolate_freepages, |
| 49 | |
| 50 | TP_PROTO(unsigned long start_pfn, |
| 51 | unsigned long end_pfn, |
| 52 | unsigned long nr_scanned, |
| 53 | unsigned long nr_taken), |
| 54 | |
| 55 | TP_ARGS(start_pfn, end_pfn, nr_scanned, nr_taken) |
| 56 | ) |
| 57 | |
| 58 | #else /* #if LINUX_VERSION_CODE >= KERNEL_VERSION(4,0,0) */ |
| 59 | |
| 60 | LTTNG_TRACEPOINT_EVENT_CLASS(compaction_isolate_template, |
| 61 | |
| 62 | TP_PROTO(unsigned long nr_scanned, |
| 63 | unsigned long nr_taken), |
| 64 | |
| 65 | TP_ARGS(nr_scanned, nr_taken), |
| 66 | |
| 67 | TP_FIELDS( |
| 68 | ctf_integer(unsigned long, nr_scanned, nr_scanned) |
| 69 | ctf_integer(unsigned long, nr_taken, nr_taken) |
| 70 | ) |
| 71 | ) |
| 72 | |
| 73 | LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(compaction_isolate_template, |
| 74 | |
| 75 | mm_compaction_isolate_migratepages, |
| 76 | |
| 77 | compaction_isolate_migratepages, |
| 78 | |
| 79 | TP_PROTO(unsigned long nr_scanned, |
| 80 | unsigned long nr_taken), |
| 81 | |
| 82 | TP_ARGS(nr_scanned, nr_taken) |
| 83 | ) |
| 84 | |
| 85 | LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(compaction_isolate_template, |
| 86 | |
| 87 | mm_compaction_isolate_freepages, |
| 88 | |
| 89 | compaction_isolate_freepages, |
| 90 | |
| 91 | TP_PROTO(unsigned long nr_scanned, |
| 92 | unsigned long nr_taken), |
| 93 | |
| 94 | TP_ARGS(nr_scanned, nr_taken) |
| 95 | ) |
| 96 | |
| 97 | #endif /* #else #if LINUX_VERSION_CODE >= KERNEL_VERSION(4,0,0) */ |
| 98 | |
| 99 | #if LTTNG_KERNEL_RANGE(3,12,30, 3,13,0) || \ |
| 100 | LTTNG_KERNEL_RANGE(3,14,25, 3,15,0) || \ |
| 101 | (LINUX_VERSION_CODE >= KERNEL_VERSION(3,16,0)) |
| 102 | LTTNG_TRACEPOINT_EVENT_CODE_MAP(mm_compaction_migratepages, |
| 103 | |
| 104 | compaction_migratepages, |
| 105 | |
| 106 | TP_PROTO(unsigned long nr_all, |
| 107 | int migrate_rc, |
| 108 | struct list_head *migratepages), |
| 109 | |
| 110 | TP_ARGS(nr_all, migrate_rc, migratepages), |
| 111 | |
| 112 | TP_locvar( |
| 113 | unsigned long nr_failed; |
| 114 | ), |
| 115 | |
| 116 | TP_code_pre( |
| 117 | tp_locvar->nr_failed = 0; |
| 118 | |
| 119 | { |
| 120 | struct list_head *page_lru; |
| 121 | |
| 122 | if (migrate_rc >= 0) |
| 123 | tp_locvar->nr_failed = migrate_rc; |
| 124 | else |
| 125 | list_for_each(page_lru, migratepages) |
| 126 | tp_locvar->nr_failed++; |
| 127 | } |
| 128 | ), |
| 129 | |
| 130 | TP_FIELDS( |
| 131 | ctf_integer(unsigned long, nr_migrated, nr_all - tp_locvar->nr_failed) |
| 132 | ctf_integer(unsigned long, nr_failed, tp_locvar->nr_failed) |
| 133 | ), |
| 134 | |
| 135 | TP_code_post() |
| 136 | ) |
| 137 | #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,16,0)) */ |
| 138 | LTTNG_TRACEPOINT_EVENT_MAP(mm_compaction_migratepages, |
| 139 | |
| 140 | compaction_migratepages, |
| 141 | |
| 142 | TP_PROTO(unsigned long nr_migrated, |
| 143 | unsigned long nr_failed), |
| 144 | |
| 145 | TP_ARGS(nr_migrated, nr_failed), |
| 146 | |
| 147 | TP_FIELDS( |
| 148 | ctf_integer(unsigned long, nr_migrated, nr_migrated) |
| 149 | ctf_integer(unsigned long, nr_failed, nr_failed) |
| 150 | ) |
| 151 | ) |
| 152 | #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,16,0)) */ |
| 153 | |
| 154 | #endif /* LTTNG_TRACE_COMPACTION_H */ |
| 155 | |
| 156 | /* This part must be outside protection */ |
| 157 | #include <probes/define_trace.h> |