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 | |
| 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 | __entry->nr_scanned = nr_scanned; |
| 26 | __entry->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 | DEFINE_EVENT(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 | DEFINE_EVENT(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 | TRACE_EVENT(mm_compaction_migratepages, |
| 50 | |
Vlastimil Babka | f8c9301 | 2014-06-04 16:08:32 -0700 | [diff] [blame] | 51 | TP_PROTO(unsigned long nr_all, |
| 52 | int migrate_rc, |
| 53 | struct list_head *migratepages), |
Mel Gorman | b7aba69 | 2011-01-13 15:45:54 -0800 | [diff] [blame] | 54 | |
Vlastimil Babka | f8c9301 | 2014-06-04 16:08:32 -0700 | [diff] [blame] | 55 | TP_ARGS(nr_all, migrate_rc, migratepages), |
Mel Gorman | b7aba69 | 2011-01-13 15:45:54 -0800 | [diff] [blame] | 56 | |
| 57 | TP_STRUCT__entry( |
| 58 | __field(unsigned long, nr_migrated) |
| 59 | __field(unsigned long, nr_failed) |
| 60 | ), |
| 61 | |
| 62 | TP_fast_assign( |
Vlastimil Babka | f8c9301 | 2014-06-04 16:08:32 -0700 | [diff] [blame] | 63 | unsigned long nr_failed = 0; |
| 64 | struct list_head *page_lru; |
| 65 | |
| 66 | /* |
| 67 | * migrate_pages() returns either a non-negative number |
| 68 | * with the number of pages that failed migration, or an |
| 69 | * error code, in which case we need to count the remaining |
| 70 | * pages manually |
| 71 | */ |
| 72 | if (migrate_rc >= 0) |
| 73 | nr_failed = migrate_rc; |
| 74 | else |
| 75 | list_for_each(page_lru, migratepages) |
| 76 | nr_failed++; |
| 77 | |
| 78 | __entry->nr_migrated = nr_all - nr_failed; |
Mel Gorman | b7aba69 | 2011-01-13 15:45:54 -0800 | [diff] [blame] | 79 | __entry->nr_failed = nr_failed; |
| 80 | ), |
| 81 | |
| 82 | TP_printk("nr_migrated=%lu nr_failed=%lu", |
| 83 | __entry->nr_migrated, |
| 84 | __entry->nr_failed) |
| 85 | ); |
| 86 | |
Mel Gorman | 0eb927c | 2014-01-21 15:51:05 -0800 | [diff] [blame] | 87 | TRACE_EVENT(mm_compaction_begin, |
Joonsoo Kim | 16c4a09 | 2015-02-11 15:27:01 -0800 | [diff] [blame^] | 88 | TP_PROTO(unsigned long zone_start, unsigned long migrate_pfn, |
| 89 | unsigned long free_pfn, unsigned long zone_end, bool sync), |
Mel Gorman | 0eb927c | 2014-01-21 15:51:05 -0800 | [diff] [blame] | 90 | |
Joonsoo Kim | 16c4a09 | 2015-02-11 15:27:01 -0800 | [diff] [blame^] | 91 | TP_ARGS(zone_start, migrate_pfn, free_pfn, zone_end, sync), |
Mel Gorman | 0eb927c | 2014-01-21 15:51:05 -0800 | [diff] [blame] | 92 | |
| 93 | TP_STRUCT__entry( |
| 94 | __field(unsigned long, zone_start) |
Joonsoo Kim | 16c4a09 | 2015-02-11 15:27:01 -0800 | [diff] [blame^] | 95 | __field(unsigned long, migrate_pfn) |
| 96 | __field(unsigned long, free_pfn) |
Mel Gorman | 0eb927c | 2014-01-21 15:51:05 -0800 | [diff] [blame] | 97 | __field(unsigned long, zone_end) |
Joonsoo Kim | 16c4a09 | 2015-02-11 15:27:01 -0800 | [diff] [blame^] | 98 | __field(bool, sync) |
Mel Gorman | 0eb927c | 2014-01-21 15:51:05 -0800 | [diff] [blame] | 99 | ), |
| 100 | |
| 101 | TP_fast_assign( |
| 102 | __entry->zone_start = zone_start; |
Joonsoo Kim | 16c4a09 | 2015-02-11 15:27:01 -0800 | [diff] [blame^] | 103 | __entry->migrate_pfn = migrate_pfn; |
| 104 | __entry->free_pfn = free_pfn; |
Mel Gorman | 0eb927c | 2014-01-21 15:51:05 -0800 | [diff] [blame] | 105 | __entry->zone_end = zone_end; |
Joonsoo Kim | 16c4a09 | 2015-02-11 15:27:01 -0800 | [diff] [blame^] | 106 | __entry->sync = sync; |
Mel Gorman | 0eb927c | 2014-01-21 15:51:05 -0800 | [diff] [blame] | 107 | ), |
| 108 | |
Joonsoo Kim | 16c4a09 | 2015-02-11 15:27:01 -0800 | [diff] [blame^] | 109 | 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] | 110 | __entry->zone_start, |
Joonsoo Kim | 16c4a09 | 2015-02-11 15:27:01 -0800 | [diff] [blame^] | 111 | __entry->migrate_pfn, |
| 112 | __entry->free_pfn, |
| 113 | __entry->zone_end, |
| 114 | __entry->sync ? "sync" : "async") |
Mel Gorman | 0eb927c | 2014-01-21 15:51:05 -0800 | [diff] [blame] | 115 | ); |
| 116 | |
| 117 | TRACE_EVENT(mm_compaction_end, |
Joonsoo Kim | 16c4a09 | 2015-02-11 15:27:01 -0800 | [diff] [blame^] | 118 | TP_PROTO(unsigned long zone_start, unsigned long migrate_pfn, |
| 119 | unsigned long free_pfn, unsigned long zone_end, bool sync, |
| 120 | int status), |
Mel Gorman | 0eb927c | 2014-01-21 15:51:05 -0800 | [diff] [blame] | 121 | |
Joonsoo Kim | 16c4a09 | 2015-02-11 15:27:01 -0800 | [diff] [blame^] | 122 | TP_ARGS(zone_start, migrate_pfn, free_pfn, zone_end, sync, status), |
Mel Gorman | 0eb927c | 2014-01-21 15:51:05 -0800 | [diff] [blame] | 123 | |
| 124 | TP_STRUCT__entry( |
Joonsoo Kim | 16c4a09 | 2015-02-11 15:27:01 -0800 | [diff] [blame^] | 125 | __field(unsigned long, zone_start) |
| 126 | __field(unsigned long, migrate_pfn) |
| 127 | __field(unsigned long, free_pfn) |
| 128 | __field(unsigned long, zone_end) |
| 129 | __field(bool, sync) |
Mel Gorman | 0eb927c | 2014-01-21 15:51:05 -0800 | [diff] [blame] | 130 | __field(int, status) |
| 131 | ), |
| 132 | |
| 133 | TP_fast_assign( |
Joonsoo Kim | 16c4a09 | 2015-02-11 15:27:01 -0800 | [diff] [blame^] | 134 | __entry->zone_start = zone_start; |
| 135 | __entry->migrate_pfn = migrate_pfn; |
| 136 | __entry->free_pfn = free_pfn; |
| 137 | __entry->zone_end = zone_end; |
| 138 | __entry->sync = sync; |
Mel Gorman | 0eb927c | 2014-01-21 15:51:05 -0800 | [diff] [blame] | 139 | __entry->status = status; |
| 140 | ), |
| 141 | |
Joonsoo Kim | 16c4a09 | 2015-02-11 15:27:01 -0800 | [diff] [blame^] | 142 | TP_printk("zone_start=0x%lx migrate_pfn=0x%lx free_pfn=0x%lx zone_end=0x%lx, mode=%s status=%s", |
| 143 | __entry->zone_start, |
| 144 | __entry->migrate_pfn, |
| 145 | __entry->free_pfn, |
| 146 | __entry->zone_end, |
| 147 | __entry->sync ? "sync" : "async", |
| 148 | compaction_status_string[__entry->status]) |
Mel Gorman | 0eb927c | 2014-01-21 15:51:05 -0800 | [diff] [blame] | 149 | ); |
Mel Gorman | b7aba69 | 2011-01-13 15:45:54 -0800 | [diff] [blame] | 150 | |
| 151 | #endif /* _TRACE_COMPACTION_H */ |
| 152 | |
| 153 | /* This part must be outside protection */ |
| 154 | #include <trace/define_trace.h> |