Mel Gorman | b7aba69 | 2011-01-13 15:45:54 -0800 | [diff] [blame] | 1 | #undef TRACE_SYSTEM |
| 2 | #define TRACE_SYSTEM compaction |
| 3 | |
| 4 | #if !defined(_TRACE_COMPACTION_H) || defined(TRACE_HEADER_MULTI_READ) |
| 5 | #define _TRACE_COMPACTION_H |
| 6 | |
| 7 | #include <linux/types.h> |
Vlastimil Babka | f8c9301 | 2014-06-04 16:08:32 -0700 | [diff] [blame] | 8 | #include <linux/list.h> |
Mel Gorman | b7aba69 | 2011-01-13 15:45:54 -0800 | [diff] [blame] | 9 | #include <linux/tracepoint.h> |
David Howells | a1ce392 | 2012-10-02 18:01:25 +0100 | [diff] [blame] | 10 | #include <trace/events/gfpflags.h> |
Mel Gorman | b7aba69 | 2011-01-13 15:45:54 -0800 | [diff] [blame] | 11 | |
| 12 | DECLARE_EVENT_CLASS(mm_compaction_isolate_template, |
| 13 | |
Joonsoo Kim | e34d85f | 2015-02-11 15:27:04 -0800 | [diff] [blame] | 14 | TP_PROTO( |
| 15 | unsigned long start_pfn, |
| 16 | unsigned long end_pfn, |
| 17 | unsigned long nr_scanned, |
Mel Gorman | b7aba69 | 2011-01-13 15:45:54 -0800 | [diff] [blame] | 18 | unsigned long nr_taken), |
| 19 | |
Joonsoo Kim | e34d85f | 2015-02-11 15:27:04 -0800 | [diff] [blame] | 20 | TP_ARGS(start_pfn, end_pfn, nr_scanned, nr_taken), |
Mel Gorman | b7aba69 | 2011-01-13 15:45:54 -0800 | [diff] [blame] | 21 | |
| 22 | TP_STRUCT__entry( |
Joonsoo Kim | e34d85f | 2015-02-11 15:27:04 -0800 | [diff] [blame] | 23 | __field(unsigned long, start_pfn) |
| 24 | __field(unsigned long, end_pfn) |
Mel Gorman | b7aba69 | 2011-01-13 15:45:54 -0800 | [diff] [blame] | 25 | __field(unsigned long, nr_scanned) |
| 26 | __field(unsigned long, nr_taken) |
| 27 | ), |
| 28 | |
| 29 | TP_fast_assign( |
Joonsoo Kim | e34d85f | 2015-02-11 15:27:04 -0800 | [diff] [blame] | 30 | __entry->start_pfn = start_pfn; |
| 31 | __entry->end_pfn = end_pfn; |
Mel Gorman | b7aba69 | 2011-01-13 15:45:54 -0800 | [diff] [blame] | 32 | __entry->nr_scanned = nr_scanned; |
| 33 | __entry->nr_taken = nr_taken; |
| 34 | ), |
| 35 | |
Joonsoo Kim | e34d85f | 2015-02-11 15:27:04 -0800 | [diff] [blame] | 36 | TP_printk("range=(0x%lx ~ 0x%lx) nr_scanned=%lu nr_taken=%lu", |
| 37 | __entry->start_pfn, |
| 38 | __entry->end_pfn, |
Mel Gorman | b7aba69 | 2011-01-13 15:45:54 -0800 | [diff] [blame] | 39 | __entry->nr_scanned, |
| 40 | __entry->nr_taken) |
| 41 | ); |
| 42 | |
| 43 | DEFINE_EVENT(mm_compaction_isolate_template, mm_compaction_isolate_migratepages, |
| 44 | |
Joonsoo Kim | e34d85f | 2015-02-11 15:27:04 -0800 | [diff] [blame] | 45 | TP_PROTO( |
| 46 | unsigned long start_pfn, |
| 47 | unsigned long end_pfn, |
| 48 | unsigned long nr_scanned, |
Mel Gorman | b7aba69 | 2011-01-13 15:45:54 -0800 | [diff] [blame] | 49 | unsigned long nr_taken), |
| 50 | |
Joonsoo Kim | e34d85f | 2015-02-11 15:27:04 -0800 | [diff] [blame] | 51 | TP_ARGS(start_pfn, end_pfn, nr_scanned, nr_taken) |
Mel Gorman | b7aba69 | 2011-01-13 15:45:54 -0800 | [diff] [blame] | 52 | ); |
| 53 | |
| 54 | DEFINE_EVENT(mm_compaction_isolate_template, mm_compaction_isolate_freepages, |
Joonsoo Kim | e34d85f | 2015-02-11 15:27:04 -0800 | [diff] [blame] | 55 | |
| 56 | TP_PROTO( |
| 57 | unsigned long start_pfn, |
| 58 | unsigned long end_pfn, |
| 59 | unsigned long nr_scanned, |
Mel Gorman | b7aba69 | 2011-01-13 15:45:54 -0800 | [diff] [blame] | 60 | unsigned long nr_taken), |
| 61 | |
Joonsoo Kim | e34d85f | 2015-02-11 15:27:04 -0800 | [diff] [blame] | 62 | TP_ARGS(start_pfn, end_pfn, nr_scanned, nr_taken) |
Mel Gorman | b7aba69 | 2011-01-13 15:45:54 -0800 | [diff] [blame] | 63 | ); |
| 64 | |
| 65 | TRACE_EVENT(mm_compaction_migratepages, |
| 66 | |
Vlastimil Babka | f8c9301 | 2014-06-04 16:08:32 -0700 | [diff] [blame] | 67 | TP_PROTO(unsigned long nr_all, |
| 68 | int migrate_rc, |
| 69 | struct list_head *migratepages), |
Mel Gorman | b7aba69 | 2011-01-13 15:45:54 -0800 | [diff] [blame] | 70 | |
Vlastimil Babka | f8c9301 | 2014-06-04 16:08:32 -0700 | [diff] [blame] | 71 | TP_ARGS(nr_all, migrate_rc, migratepages), |
Mel Gorman | b7aba69 | 2011-01-13 15:45:54 -0800 | [diff] [blame] | 72 | |
| 73 | TP_STRUCT__entry( |
| 74 | __field(unsigned long, nr_migrated) |
| 75 | __field(unsigned long, nr_failed) |
| 76 | ), |
| 77 | |
| 78 | TP_fast_assign( |
Vlastimil Babka | f8c9301 | 2014-06-04 16:08:32 -0700 | [diff] [blame] | 79 | unsigned long nr_failed = 0; |
| 80 | struct list_head *page_lru; |
| 81 | |
| 82 | /* |
| 83 | * migrate_pages() returns either a non-negative number |
| 84 | * with the number of pages that failed migration, or an |
| 85 | * error code, in which case we need to count the remaining |
| 86 | * pages manually |
| 87 | */ |
| 88 | if (migrate_rc >= 0) |
| 89 | nr_failed = migrate_rc; |
| 90 | else |
| 91 | list_for_each(page_lru, migratepages) |
| 92 | nr_failed++; |
| 93 | |
| 94 | __entry->nr_migrated = nr_all - nr_failed; |
Mel Gorman | b7aba69 | 2011-01-13 15:45:54 -0800 | [diff] [blame] | 95 | __entry->nr_failed = nr_failed; |
| 96 | ), |
| 97 | |
| 98 | TP_printk("nr_migrated=%lu nr_failed=%lu", |
| 99 | __entry->nr_migrated, |
| 100 | __entry->nr_failed) |
| 101 | ); |
| 102 | |
Mel Gorman | 0eb927c | 2014-01-21 15:51:05 -0800 | [diff] [blame] | 103 | TRACE_EVENT(mm_compaction_begin, |
Joonsoo Kim | 16c4a09 | 2015-02-11 15:27:01 -0800 | [diff] [blame] | 104 | TP_PROTO(unsigned long zone_start, unsigned long migrate_pfn, |
| 105 | unsigned long free_pfn, unsigned long zone_end, bool sync), |
Mel Gorman | 0eb927c | 2014-01-21 15:51:05 -0800 | [diff] [blame] | 106 | |
Joonsoo Kim | 16c4a09 | 2015-02-11 15:27:01 -0800 | [diff] [blame] | 107 | TP_ARGS(zone_start, migrate_pfn, free_pfn, zone_end, sync), |
Mel Gorman | 0eb927c | 2014-01-21 15:51:05 -0800 | [diff] [blame] | 108 | |
| 109 | TP_STRUCT__entry( |
| 110 | __field(unsigned long, zone_start) |
Joonsoo Kim | 16c4a09 | 2015-02-11 15:27:01 -0800 | [diff] [blame] | 111 | __field(unsigned long, migrate_pfn) |
| 112 | __field(unsigned long, free_pfn) |
Mel Gorman | 0eb927c | 2014-01-21 15:51:05 -0800 | [diff] [blame] | 113 | __field(unsigned long, zone_end) |
Joonsoo Kim | 16c4a09 | 2015-02-11 15:27:01 -0800 | [diff] [blame] | 114 | __field(bool, sync) |
Mel Gorman | 0eb927c | 2014-01-21 15:51:05 -0800 | [diff] [blame] | 115 | ), |
| 116 | |
| 117 | TP_fast_assign( |
| 118 | __entry->zone_start = zone_start; |
Joonsoo Kim | 16c4a09 | 2015-02-11 15:27:01 -0800 | [diff] [blame] | 119 | __entry->migrate_pfn = migrate_pfn; |
| 120 | __entry->free_pfn = free_pfn; |
Mel Gorman | 0eb927c | 2014-01-21 15:51:05 -0800 | [diff] [blame] | 121 | __entry->zone_end = zone_end; |
Joonsoo Kim | 16c4a09 | 2015-02-11 15:27:01 -0800 | [diff] [blame] | 122 | __entry->sync = sync; |
Mel Gorman | 0eb927c | 2014-01-21 15:51:05 -0800 | [diff] [blame] | 123 | ), |
| 124 | |
Joonsoo Kim | 16c4a09 | 2015-02-11 15:27:01 -0800 | [diff] [blame] | 125 | TP_printk("zone_start=0x%lx migrate_pfn=0x%lx free_pfn=0x%lx zone_end=0x%lx, mode=%s", |
Mel Gorman | 0eb927c | 2014-01-21 15:51:05 -0800 | [diff] [blame] | 126 | __entry->zone_start, |
Joonsoo Kim | 16c4a09 | 2015-02-11 15:27:01 -0800 | [diff] [blame] | 127 | __entry->migrate_pfn, |
| 128 | __entry->free_pfn, |
| 129 | __entry->zone_end, |
| 130 | __entry->sync ? "sync" : "async") |
Mel Gorman | 0eb927c | 2014-01-21 15:51:05 -0800 | [diff] [blame] | 131 | ); |
| 132 | |
| 133 | TRACE_EVENT(mm_compaction_end, |
Joonsoo Kim | 16c4a09 | 2015-02-11 15:27:01 -0800 | [diff] [blame] | 134 | TP_PROTO(unsigned long zone_start, unsigned long migrate_pfn, |
| 135 | unsigned long free_pfn, unsigned long zone_end, bool sync, |
| 136 | int status), |
Mel Gorman | 0eb927c | 2014-01-21 15:51:05 -0800 | [diff] [blame] | 137 | |
Joonsoo Kim | 16c4a09 | 2015-02-11 15:27:01 -0800 | [diff] [blame] | 138 | TP_ARGS(zone_start, migrate_pfn, free_pfn, zone_end, sync, status), |
Mel Gorman | 0eb927c | 2014-01-21 15:51:05 -0800 | [diff] [blame] | 139 | |
| 140 | TP_STRUCT__entry( |
Joonsoo Kim | 16c4a09 | 2015-02-11 15:27:01 -0800 | [diff] [blame] | 141 | __field(unsigned long, zone_start) |
| 142 | __field(unsigned long, migrate_pfn) |
| 143 | __field(unsigned long, free_pfn) |
| 144 | __field(unsigned long, zone_end) |
| 145 | __field(bool, sync) |
Mel Gorman | 0eb927c | 2014-01-21 15:51:05 -0800 | [diff] [blame] | 146 | __field(int, status) |
| 147 | ), |
| 148 | |
| 149 | TP_fast_assign( |
Joonsoo Kim | 16c4a09 | 2015-02-11 15:27:01 -0800 | [diff] [blame] | 150 | __entry->zone_start = zone_start; |
| 151 | __entry->migrate_pfn = migrate_pfn; |
| 152 | __entry->free_pfn = free_pfn; |
| 153 | __entry->zone_end = zone_end; |
| 154 | __entry->sync = sync; |
Mel Gorman | 0eb927c | 2014-01-21 15:51:05 -0800 | [diff] [blame] | 155 | __entry->status = status; |
| 156 | ), |
| 157 | |
Joonsoo Kim | 16c4a09 | 2015-02-11 15:27:01 -0800 | [diff] [blame] | 158 | TP_printk("zone_start=0x%lx migrate_pfn=0x%lx free_pfn=0x%lx zone_end=0x%lx, mode=%s status=%s", |
| 159 | __entry->zone_start, |
| 160 | __entry->migrate_pfn, |
| 161 | __entry->free_pfn, |
| 162 | __entry->zone_end, |
| 163 | __entry->sync ? "sync" : "async", |
| 164 | compaction_status_string[__entry->status]) |
Mel Gorman | 0eb927c | 2014-01-21 15:51:05 -0800 | [diff] [blame] | 165 | ); |
Mel Gorman | b7aba69 | 2011-01-13 15:45:54 -0800 | [diff] [blame] | 166 | |
Joonsoo Kim | 837d026 | 2015-02-11 15:27:06 -0800 | [diff] [blame] | 167 | TRACE_EVENT(mm_compaction_try_to_compact_pages, |
| 168 | |
| 169 | TP_PROTO( |
| 170 | int order, |
| 171 | gfp_t gfp_mask, |
| 172 | enum migrate_mode mode), |
| 173 | |
| 174 | TP_ARGS(order, gfp_mask, mode), |
| 175 | |
| 176 | TP_STRUCT__entry( |
| 177 | __field(int, order) |
| 178 | __field(gfp_t, gfp_mask) |
| 179 | __field(enum migrate_mode, mode) |
| 180 | ), |
| 181 | |
| 182 | TP_fast_assign( |
| 183 | __entry->order = order; |
| 184 | __entry->gfp_mask = gfp_mask; |
| 185 | __entry->mode = mode; |
| 186 | ), |
| 187 | |
| 188 | TP_printk("order=%d gfp_mask=0x%x mode=%d", |
| 189 | __entry->order, |
| 190 | __entry->gfp_mask, |
| 191 | (int)__entry->mode) |
| 192 | ); |
| 193 | |
| 194 | DECLARE_EVENT_CLASS(mm_compaction_suitable_template, |
| 195 | |
| 196 | TP_PROTO(struct zone *zone, |
| 197 | int order, |
| 198 | int ret), |
| 199 | |
| 200 | TP_ARGS(zone, order, ret), |
| 201 | |
| 202 | TP_STRUCT__entry( |
| 203 | __field(int, nid) |
| 204 | __field(char *, name) |
| 205 | __field(int, order) |
| 206 | __field(int, ret) |
| 207 | ), |
| 208 | |
| 209 | TP_fast_assign( |
| 210 | __entry->nid = zone_to_nid(zone); |
| 211 | __entry->name = (char *)zone->name; |
| 212 | __entry->order = order; |
| 213 | __entry->ret = ret; |
| 214 | ), |
| 215 | |
| 216 | TP_printk("node=%d zone=%-8s order=%d ret=%s", |
| 217 | __entry->nid, |
| 218 | __entry->name, |
| 219 | __entry->order, |
| 220 | compaction_status_string[__entry->ret]) |
| 221 | ); |
| 222 | |
| 223 | DEFINE_EVENT(mm_compaction_suitable_template, mm_compaction_finished, |
| 224 | |
| 225 | TP_PROTO(struct zone *zone, |
| 226 | int order, |
| 227 | int ret), |
| 228 | |
| 229 | TP_ARGS(zone, order, ret) |
| 230 | ); |
| 231 | |
| 232 | DEFINE_EVENT(mm_compaction_suitable_template, mm_compaction_suitable, |
| 233 | |
| 234 | TP_PROTO(struct zone *zone, |
| 235 | int order, |
| 236 | int ret), |
| 237 | |
| 238 | TP_ARGS(zone, order, ret) |
| 239 | ); |
| 240 | |
Joonsoo Kim | 24e2716 | 2015-02-11 15:27:09 -0800 | [diff] [blame] | 241 | #ifdef CONFIG_COMPACTION |
| 242 | DECLARE_EVENT_CLASS(mm_compaction_defer_template, |
| 243 | |
| 244 | TP_PROTO(struct zone *zone, int order), |
| 245 | |
| 246 | TP_ARGS(zone, order), |
| 247 | |
| 248 | TP_STRUCT__entry( |
| 249 | __field(int, nid) |
| 250 | __field(char *, name) |
| 251 | __field(int, order) |
| 252 | __field(unsigned int, considered) |
| 253 | __field(unsigned int, defer_shift) |
| 254 | __field(int, order_failed) |
| 255 | ), |
| 256 | |
| 257 | TP_fast_assign( |
| 258 | __entry->nid = zone_to_nid(zone); |
| 259 | __entry->name = (char *)zone->name; |
| 260 | __entry->order = order; |
| 261 | __entry->considered = zone->compact_considered; |
| 262 | __entry->defer_shift = zone->compact_defer_shift; |
| 263 | __entry->order_failed = zone->compact_order_failed; |
| 264 | ), |
| 265 | |
| 266 | TP_printk("node=%d zone=%-8s order=%d order_failed=%d consider=%u limit=%lu", |
| 267 | __entry->nid, |
| 268 | __entry->name, |
| 269 | __entry->order, |
| 270 | __entry->order_failed, |
| 271 | __entry->considered, |
| 272 | 1UL << __entry->defer_shift) |
| 273 | ); |
| 274 | |
| 275 | DEFINE_EVENT(mm_compaction_defer_template, mm_compaction_deferred, |
| 276 | |
| 277 | TP_PROTO(struct zone *zone, int order), |
| 278 | |
| 279 | TP_ARGS(zone, order) |
| 280 | ); |
| 281 | |
| 282 | DEFINE_EVENT(mm_compaction_defer_template, mm_compaction_defer_compaction, |
| 283 | |
| 284 | TP_PROTO(struct zone *zone, int order), |
| 285 | |
| 286 | TP_ARGS(zone, order) |
| 287 | ); |
| 288 | |
| 289 | DEFINE_EVENT(mm_compaction_defer_template, mm_compaction_defer_reset, |
| 290 | |
| 291 | TP_PROTO(struct zone *zone, int order), |
| 292 | |
| 293 | TP_ARGS(zone, order) |
| 294 | ); |
| 295 | #endif |
| 296 | |
Mel Gorman | b7aba69 | 2011-01-13 15:45:54 -0800 | [diff] [blame] | 297 | #endif /* _TRACE_COMPACTION_H */ |
| 298 | |
| 299 | /* This part must be outside protection */ |
| 300 | #include <trace/define_trace.h> |