diff options
| -rw-r--r-- | include/linux/compaction.h | 1 | ||||
| -rw-r--r-- | include/trace/events/compaction.h | 49 | ||||
| -rw-r--r-- | mm/compaction.c | 15 |
3 files changed, 49 insertions, 16 deletions
diff --git a/include/linux/compaction.h b/include/linux/compaction.h index f2efda2e6ac6..db64cae06530 100644 --- a/include/linux/compaction.h +++ b/include/linux/compaction.h | |||
| @@ -12,6 +12,7 @@ | |||
| 12 | #define COMPACT_PARTIAL 3 | 12 | #define COMPACT_PARTIAL 3 |
| 13 | /* The full zone was compacted */ | 13 | /* The full zone was compacted */ |
| 14 | #define COMPACT_COMPLETE 4 | 14 | #define COMPACT_COMPLETE 4 |
| 15 | /* When adding new state, please change compaction_status_string, too */ | ||
| 15 | 16 | ||
| 16 | /* Used to signal whether compaction detected need_sched() or lock contention */ | 17 | /* Used to signal whether compaction detected need_sched() or lock contention */ |
| 17 | /* No contention detected */ | 18 | /* No contention detected */ |
diff --git a/include/trace/events/compaction.h b/include/trace/events/compaction.h index 1337d9e01e3d..839f6fac921a 100644 --- a/include/trace/events/compaction.h +++ b/include/trace/events/compaction.h | |||
| @@ -85,46 +85,67 @@ TRACE_EVENT(mm_compaction_migratepages, | |||
| 85 | ); | 85 | ); |
| 86 | 86 | ||
| 87 | TRACE_EVENT(mm_compaction_begin, | 87 | TRACE_EVENT(mm_compaction_begin, |
| 88 | TP_PROTO(unsigned long zone_start, unsigned long migrate_start, | 88 | TP_PROTO(unsigned long zone_start, unsigned long migrate_pfn, |
| 89 | unsigned long free_start, unsigned long zone_end), | 89 | unsigned long free_pfn, unsigned long zone_end, bool sync), |
| 90 | 90 | ||
| 91 | TP_ARGS(zone_start, migrate_start, free_start, zone_end), | 91 | TP_ARGS(zone_start, migrate_pfn, free_pfn, zone_end, sync), |
| 92 | 92 | ||
| 93 | TP_STRUCT__entry( | 93 | TP_STRUCT__entry( |
| 94 | __field(unsigned long, zone_start) | 94 | __field(unsigned long, zone_start) |
| 95 | __field(unsigned long, migrate_start) | 95 | __field(unsigned long, migrate_pfn) |
| 96 | __field(unsigned long, free_start) | 96 | __field(unsigned long, free_pfn) |
| 97 | __field(unsigned long, zone_end) | 97 | __field(unsigned long, zone_end) |
| 98 | __field(bool, sync) | ||
| 98 | ), | 99 | ), |
| 99 | 100 | ||
| 100 | TP_fast_assign( | 101 | TP_fast_assign( |
| 101 | __entry->zone_start = zone_start; | 102 | __entry->zone_start = zone_start; |
| 102 | __entry->migrate_start = migrate_start; | 103 | __entry->migrate_pfn = migrate_pfn; |
| 103 | __entry->free_start = free_start; | 104 | __entry->free_pfn = free_pfn; |
| 104 | __entry->zone_end = zone_end; | 105 | __entry->zone_end = zone_end; |
| 106 | __entry->sync = sync; | ||
| 105 | ), | 107 | ), |
| 106 | 108 | ||
| 107 | TP_printk("zone_start=0x%lx migrate_start=0x%lx free_start=0x%lx zone_end=0x%lx", | 109 | TP_printk("zone_start=0x%lx migrate_pfn=0x%lx free_pfn=0x%lx zone_end=0x%lx, mode=%s", |
| 108 | __entry->zone_start, | 110 | __entry->zone_start, |
| 109 | __entry->migrate_start, | 111 | __entry->migrate_pfn, |
| 110 | __entry->free_start, | 112 | __entry->free_pfn, |
| 111 | __entry->zone_end) | 113 | __entry->zone_end, |
| 114 | __entry->sync ? "sync" : "async") | ||
| 112 | ); | 115 | ); |
| 113 | 116 | ||
| 114 | TRACE_EVENT(mm_compaction_end, | 117 | TRACE_EVENT(mm_compaction_end, |
| 115 | TP_PROTO(int status), | 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), | ||
| 116 | 121 | ||
| 117 | TP_ARGS(status), | 122 | TP_ARGS(zone_start, migrate_pfn, free_pfn, zone_end, sync, status), |
| 118 | 123 | ||
| 119 | TP_STRUCT__entry( | 124 | TP_STRUCT__entry( |
| 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) | ||
| 120 | __field(int, status) | 130 | __field(int, status) |
| 121 | ), | 131 | ), |
| 122 | 132 | ||
| 123 | TP_fast_assign( | 133 | TP_fast_assign( |
| 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; | ||
| 124 | __entry->status = status; | 139 | __entry->status = status; |
| 125 | ), | 140 | ), |
| 126 | 141 | ||
| 127 | TP_printk("status=%d", __entry->status) | 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]) | ||
| 128 | ); | 149 | ); |
| 129 | 150 | ||
| 130 | #endif /* _TRACE_COMPACTION_H */ | 151 | #endif /* _TRACE_COMPACTION_H */ |
diff --git a/mm/compaction.c b/mm/compaction.c index 9c7e6909dd29..66f7c365e888 100644 --- a/mm/compaction.c +++ b/mm/compaction.c | |||
| @@ -34,6 +34,15 @@ static inline void count_compact_events(enum vm_event_item item, long delta) | |||
| 34 | #endif | 34 | #endif |
| 35 | 35 | ||
| 36 | #if defined CONFIG_COMPACTION || defined CONFIG_CMA | 36 | #if defined CONFIG_COMPACTION || defined CONFIG_CMA |
| 37 | #ifdef CONFIG_TRACEPOINTS | ||
| 38 | static const char *const compaction_status_string[] = { | ||
| 39 | "deferred", | ||
| 40 | "skipped", | ||
| 41 | "continue", | ||
| 42 | "partial", | ||
| 43 | "complete", | ||
| 44 | }; | ||
| 45 | #endif | ||
| 37 | 46 | ||
| 38 | #define CREATE_TRACE_POINTS | 47 | #define CREATE_TRACE_POINTS |
| 39 | #include <trace/events/compaction.h> | 48 | #include <trace/events/compaction.h> |
| @@ -1197,7 +1206,8 @@ static int compact_zone(struct zone *zone, struct compact_control *cc) | |||
| 1197 | zone->compact_cached_migrate_pfn[1] = cc->migrate_pfn; | 1206 | zone->compact_cached_migrate_pfn[1] = cc->migrate_pfn; |
| 1198 | } | 1207 | } |
| 1199 | 1208 | ||
| 1200 | trace_mm_compaction_begin(start_pfn, cc->migrate_pfn, cc->free_pfn, end_pfn); | 1209 | trace_mm_compaction_begin(start_pfn, cc->migrate_pfn, |
| 1210 | cc->free_pfn, end_pfn, sync); | ||
| 1201 | 1211 | ||
| 1202 | migrate_prep_local(); | 1212 | migrate_prep_local(); |
| 1203 | 1213 | ||
| @@ -1299,7 +1309,8 @@ out: | |||
| 1299 | zone->compact_cached_free_pfn = free_pfn; | 1309 | zone->compact_cached_free_pfn = free_pfn; |
| 1300 | } | 1310 | } |
| 1301 | 1311 | ||
| 1302 | trace_mm_compaction_end(ret); | 1312 | trace_mm_compaction_end(start_pfn, cc->migrate_pfn, |
| 1313 | cc->free_pfn, end_pfn, sync, ret); | ||
| 1303 | 1314 | ||
| 1304 | return ret; | 1315 | return ret; |
| 1305 | } | 1316 | } |
