1 /* SPDX-License-Identifier: GPL-2.0 */ 1 /* SPDX-License-Identifier: GPL-2.0 */ 2 #undef TRACE_SYSTEM 2 #undef TRACE_SYSTEM 3 #define TRACE_SYSTEM compaction 3 #define TRACE_SYSTEM compaction 4 4 5 #if !defined(_TRACE_COMPACTION_H) || defined(T 5 #if !defined(_TRACE_COMPACTION_H) || defined(TRACE_HEADER_MULTI_READ) 6 #define _TRACE_COMPACTION_H 6 #define _TRACE_COMPACTION_H 7 7 8 #include <linux/types.h> 8 #include <linux/types.h> 9 #include <linux/list.h> 9 #include <linux/list.h> 10 #include <linux/tracepoint.h> 10 #include <linux/tracepoint.h> 11 #include <trace/events/mmflags.h> 11 #include <trace/events/mmflags.h> 12 12 13 13 14 DECLARE_EVENT_CLASS(mm_compaction_isolate_temp 14 DECLARE_EVENT_CLASS(mm_compaction_isolate_template, 15 15 16 TP_PROTO( 16 TP_PROTO( 17 unsigned long start_pfn, 17 unsigned long start_pfn, 18 unsigned long end_pfn, 18 unsigned long end_pfn, 19 unsigned long nr_scanned, 19 unsigned long nr_scanned, 20 unsigned long nr_taken), 20 unsigned long nr_taken), 21 21 22 TP_ARGS(start_pfn, end_pfn, nr_scanned 22 TP_ARGS(start_pfn, end_pfn, nr_scanned, nr_taken), 23 23 24 TP_STRUCT__entry( 24 TP_STRUCT__entry( 25 __field(unsigned long, start_p 25 __field(unsigned long, start_pfn) 26 __field(unsigned long, end_pfn 26 __field(unsigned long, end_pfn) 27 __field(unsigned long, nr_scan 27 __field(unsigned long, nr_scanned) 28 __field(unsigned long, nr_take 28 __field(unsigned long, nr_taken) 29 ), 29 ), 30 30 31 TP_fast_assign( 31 TP_fast_assign( 32 __entry->start_pfn = start_pfn 32 __entry->start_pfn = start_pfn; 33 __entry->end_pfn = end_pfn; 33 __entry->end_pfn = end_pfn; 34 __entry->nr_scanned = nr_scann 34 __entry->nr_scanned = nr_scanned; 35 __entry->nr_taken = nr_taken; 35 __entry->nr_taken = nr_taken; 36 ), 36 ), 37 37 38 TP_printk("range=(0x%lx ~ 0x%lx) nr_sc 38 TP_printk("range=(0x%lx ~ 0x%lx) nr_scanned=%lu nr_taken=%lu", 39 __entry->start_pfn, 39 __entry->start_pfn, 40 __entry->end_pfn, 40 __entry->end_pfn, 41 __entry->nr_scanned, 41 __entry->nr_scanned, 42 __entry->nr_taken) 42 __entry->nr_taken) 43 ); 43 ); 44 44 45 DEFINE_EVENT(mm_compaction_isolate_template, m 45 DEFINE_EVENT(mm_compaction_isolate_template, mm_compaction_isolate_migratepages, 46 46 47 TP_PROTO( 47 TP_PROTO( 48 unsigned long start_pfn, 48 unsigned long start_pfn, 49 unsigned long end_pfn, 49 unsigned long end_pfn, 50 unsigned long nr_scanned, 50 unsigned long nr_scanned, 51 unsigned long nr_taken), 51 unsigned long nr_taken), 52 52 53 TP_ARGS(start_pfn, end_pfn, nr_scanned 53 TP_ARGS(start_pfn, end_pfn, nr_scanned, nr_taken) 54 ); 54 ); 55 55 56 DEFINE_EVENT(mm_compaction_isolate_template, m 56 DEFINE_EVENT(mm_compaction_isolate_template, mm_compaction_isolate_freepages, 57 57 58 TP_PROTO( 58 TP_PROTO( 59 unsigned long start_pfn, 59 unsigned long start_pfn, 60 unsigned long end_pfn, 60 unsigned long end_pfn, 61 unsigned long nr_scanned, 61 unsigned long nr_scanned, 62 unsigned long nr_taken), 62 unsigned long nr_taken), 63 63 64 TP_ARGS(start_pfn, end_pfn, nr_scanned 64 TP_ARGS(start_pfn, end_pfn, nr_scanned, nr_taken) 65 ); 65 ); 66 66 67 DEFINE_EVENT(mm_compaction_isolate_template, m << 68 << 69 TP_PROTO( << 70 unsigned long start_pfn, << 71 unsigned long end_pfn, << 72 unsigned long nr_scanned, << 73 unsigned long nr_taken), << 74 << 75 TP_ARGS(start_pfn, end_pfn, nr_scanned << 76 ); << 77 << 78 #ifdef CONFIG_COMPACTION 67 #ifdef CONFIG_COMPACTION 79 TRACE_EVENT(mm_compaction_migratepages, 68 TRACE_EVENT(mm_compaction_migratepages, 80 69 81 TP_PROTO(unsigned int nr_migratepages, !! 70 TP_PROTO(struct compact_control *cc, 82 unsigned int nr_succeeded), 71 unsigned int nr_succeeded), 83 72 84 TP_ARGS(nr_migratepages, nr_succeeded) !! 73 TP_ARGS(cc, nr_succeeded), 85 74 86 TP_STRUCT__entry( 75 TP_STRUCT__entry( 87 __field(unsigned long, nr_migr 76 __field(unsigned long, nr_migrated) 88 __field(unsigned long, nr_fail 77 __field(unsigned long, nr_failed) 89 ), 78 ), 90 79 91 TP_fast_assign( 80 TP_fast_assign( 92 __entry->nr_migrated = nr_succ 81 __entry->nr_migrated = nr_succeeded; 93 __entry->nr_failed = nr_migrat !! 82 __entry->nr_failed = cc->nr_migratepages - nr_succeeded; 94 ), 83 ), 95 84 96 TP_printk("nr_migrated=%lu nr_failed=% 85 TP_printk("nr_migrated=%lu nr_failed=%lu", 97 __entry->nr_migrated, 86 __entry->nr_migrated, 98 __entry->nr_failed) 87 __entry->nr_failed) 99 ); 88 ); 100 89 101 TRACE_EVENT(mm_compaction_begin, 90 TRACE_EVENT(mm_compaction_begin, 102 TP_PROTO(struct compact_control *cc, u 91 TP_PROTO(struct compact_control *cc, unsigned long zone_start, 103 unsigned long zone_end, bool s 92 unsigned long zone_end, bool sync), 104 93 105 TP_ARGS(cc, zone_start, zone_end, sync 94 TP_ARGS(cc, zone_start, zone_end, sync), 106 95 107 TP_STRUCT__entry( 96 TP_STRUCT__entry( 108 __field(unsigned long, zone_st 97 __field(unsigned long, zone_start) 109 __field(unsigned long, migrate 98 __field(unsigned long, migrate_pfn) 110 __field(unsigned long, free_pf 99 __field(unsigned long, free_pfn) 111 __field(unsigned long, zone_en 100 __field(unsigned long, zone_end) 112 __field(bool, sync) 101 __field(bool, sync) 113 ), 102 ), 114 103 115 TP_fast_assign( 104 TP_fast_assign( 116 __entry->zone_start = zone_sta 105 __entry->zone_start = zone_start; 117 __entry->migrate_pfn = cc->mig 106 __entry->migrate_pfn = cc->migrate_pfn; 118 __entry->free_pfn = cc->free_p 107 __entry->free_pfn = cc->free_pfn; 119 __entry->zone_end = zone_end; 108 __entry->zone_end = zone_end; 120 __entry->sync = sync; 109 __entry->sync = sync; 121 ), 110 ), 122 111 123 TP_printk("zone_start=0x%lx migrate_pf 112 TP_printk("zone_start=0x%lx migrate_pfn=0x%lx free_pfn=0x%lx zone_end=0x%lx, mode=%s", 124 __entry->zone_start, 113 __entry->zone_start, 125 __entry->migrate_pfn, 114 __entry->migrate_pfn, 126 __entry->free_pfn, 115 __entry->free_pfn, 127 __entry->zone_end, 116 __entry->zone_end, 128 __entry->sync ? "sync" : "asyn 117 __entry->sync ? "sync" : "async") 129 ); 118 ); 130 119 131 TRACE_EVENT(mm_compaction_end, 120 TRACE_EVENT(mm_compaction_end, 132 TP_PROTO(struct compact_control *cc, u 121 TP_PROTO(struct compact_control *cc, unsigned long zone_start, 133 unsigned long zone_end, bool s 122 unsigned long zone_end, bool sync, 134 int status), 123 int status), 135 124 136 TP_ARGS(cc, zone_start, zone_end, sync 125 TP_ARGS(cc, zone_start, zone_end, sync, status), 137 126 138 TP_STRUCT__entry( 127 TP_STRUCT__entry( 139 __field(unsigned long, zone_st 128 __field(unsigned long, zone_start) 140 __field(unsigned long, migrate 129 __field(unsigned long, migrate_pfn) 141 __field(unsigned long, free_pf 130 __field(unsigned long, free_pfn) 142 __field(unsigned long, zone_en 131 __field(unsigned long, zone_end) 143 __field(bool, sync) 132 __field(bool, sync) 144 __field(int, status) 133 __field(int, status) 145 ), 134 ), 146 135 147 TP_fast_assign( 136 TP_fast_assign( 148 __entry->zone_start = zone_sta 137 __entry->zone_start = zone_start; 149 __entry->migrate_pfn = cc->mig 138 __entry->migrate_pfn = cc->migrate_pfn; 150 __entry->free_pfn = cc->free_p 139 __entry->free_pfn = cc->free_pfn; 151 __entry->zone_end = zone_end; 140 __entry->zone_end = zone_end; 152 __entry->sync = sync; 141 __entry->sync = sync; 153 __entry->status = status; 142 __entry->status = status; 154 ), 143 ), 155 144 156 TP_printk("zone_start=0x%lx migrate_pf 145 TP_printk("zone_start=0x%lx migrate_pfn=0x%lx free_pfn=0x%lx zone_end=0x%lx, mode=%s status=%s", 157 __entry->zone_start, 146 __entry->zone_start, 158 __entry->migrate_pfn, 147 __entry->migrate_pfn, 159 __entry->free_pfn, 148 __entry->free_pfn, 160 __entry->zone_end, 149 __entry->zone_end, 161 __entry->sync ? "sync" : "asyn 150 __entry->sync ? "sync" : "async", 162 __print_symbolic(__entry->stat 151 __print_symbolic(__entry->status, COMPACTION_STATUS)) 163 ); 152 ); 164 153 165 TRACE_EVENT(mm_compaction_try_to_compact_pages 154 TRACE_EVENT(mm_compaction_try_to_compact_pages, 166 155 167 TP_PROTO( 156 TP_PROTO( 168 int order, 157 int order, 169 gfp_t gfp_mask, 158 gfp_t gfp_mask, 170 int prio), 159 int prio), 171 160 172 TP_ARGS(order, gfp_mask, prio), 161 TP_ARGS(order, gfp_mask, prio), 173 162 174 TP_STRUCT__entry( 163 TP_STRUCT__entry( 175 __field(int, order) 164 __field(int, order) 176 __field(unsigned long, gfp_mas 165 __field(unsigned long, gfp_mask) 177 __field(int, prio) 166 __field(int, prio) 178 ), 167 ), 179 168 180 TP_fast_assign( 169 TP_fast_assign( 181 __entry->order = order; 170 __entry->order = order; 182 __entry->gfp_mask = (__force u 171 __entry->gfp_mask = (__force unsigned long)gfp_mask; 183 __entry->prio = prio; 172 __entry->prio = prio; 184 ), 173 ), 185 174 186 TP_printk("order=%d gfp_mask=%s priori 175 TP_printk("order=%d gfp_mask=%s priority=%d", 187 __entry->order, 176 __entry->order, 188 show_gfp_flags(__entry->gfp_ma 177 show_gfp_flags(__entry->gfp_mask), 189 __entry->prio) 178 __entry->prio) 190 ); 179 ); 191 180 192 DECLARE_EVENT_CLASS(mm_compaction_suitable_tem 181 DECLARE_EVENT_CLASS(mm_compaction_suitable_template, 193 182 194 TP_PROTO(struct zone *zone, 183 TP_PROTO(struct zone *zone, 195 int order, 184 int order, 196 int ret), 185 int ret), 197 186 198 TP_ARGS(zone, order, ret), 187 TP_ARGS(zone, order, ret), 199 188 200 TP_STRUCT__entry( 189 TP_STRUCT__entry( 201 __field(int, nid) 190 __field(int, nid) 202 __field(enum zone_type, idx) 191 __field(enum zone_type, idx) 203 __field(int, order) 192 __field(int, order) 204 __field(int, ret) 193 __field(int, ret) 205 ), 194 ), 206 195 207 TP_fast_assign( 196 TP_fast_assign( 208 __entry->nid = zone_to_nid(zon 197 __entry->nid = zone_to_nid(zone); 209 __entry->idx = zone_idx(zone); 198 __entry->idx = zone_idx(zone); 210 __entry->order = order; 199 __entry->order = order; 211 __entry->ret = ret; 200 __entry->ret = ret; 212 ), 201 ), 213 202 214 TP_printk("node=%d zone=%-8s order=%d 203 TP_printk("node=%d zone=%-8s order=%d ret=%s", 215 __entry->nid, 204 __entry->nid, 216 __print_symbolic(__entry->idx, 205 __print_symbolic(__entry->idx, ZONE_TYPE), 217 __entry->order, 206 __entry->order, 218 __print_symbolic(__entry->ret, 207 __print_symbolic(__entry->ret, COMPACTION_STATUS)) 219 ); 208 ); 220 209 221 DEFINE_EVENT(mm_compaction_suitable_template, 210 DEFINE_EVENT(mm_compaction_suitable_template, mm_compaction_finished, 222 211 223 TP_PROTO(struct zone *zone, 212 TP_PROTO(struct zone *zone, 224 int order, 213 int order, 225 int ret), 214 int ret), 226 215 227 TP_ARGS(zone, order, ret) 216 TP_ARGS(zone, order, ret) 228 ); 217 ); 229 218 230 DEFINE_EVENT(mm_compaction_suitable_template, 219 DEFINE_EVENT(mm_compaction_suitable_template, mm_compaction_suitable, 231 220 232 TP_PROTO(struct zone *zone, 221 TP_PROTO(struct zone *zone, 233 int order, 222 int order, 234 int ret), 223 int ret), 235 224 236 TP_ARGS(zone, order, ret) 225 TP_ARGS(zone, order, ret) 237 ); 226 ); 238 227 239 DECLARE_EVENT_CLASS(mm_compaction_defer_templa 228 DECLARE_EVENT_CLASS(mm_compaction_defer_template, 240 229 241 TP_PROTO(struct zone *zone, int order) 230 TP_PROTO(struct zone *zone, int order), 242 231 243 TP_ARGS(zone, order), 232 TP_ARGS(zone, order), 244 233 245 TP_STRUCT__entry( 234 TP_STRUCT__entry( 246 __field(int, nid) 235 __field(int, nid) 247 __field(enum zone_type, idx) 236 __field(enum zone_type, idx) 248 __field(int, order) 237 __field(int, order) 249 __field(unsigned int, consider 238 __field(unsigned int, considered) 250 __field(unsigned int, defer_sh 239 __field(unsigned int, defer_shift) 251 __field(int, order_failed) 240 __field(int, order_failed) 252 ), 241 ), 253 242 254 TP_fast_assign( 243 TP_fast_assign( 255 __entry->nid = zone_to_nid(zon 244 __entry->nid = zone_to_nid(zone); 256 __entry->idx = zone_idx(zone); 245 __entry->idx = zone_idx(zone); 257 __entry->order = order; 246 __entry->order = order; 258 __entry->considered = zone->co 247 __entry->considered = zone->compact_considered; 259 __entry->defer_shift = zone->c 248 __entry->defer_shift = zone->compact_defer_shift; 260 __entry->order_failed = zone-> 249 __entry->order_failed = zone->compact_order_failed; 261 ), 250 ), 262 251 263 TP_printk("node=%d zone=%-8s order=%d 252 TP_printk("node=%d zone=%-8s order=%d order_failed=%d consider=%u limit=%lu", 264 __entry->nid, 253 __entry->nid, 265 __print_symbolic(__entry->idx, 254 __print_symbolic(__entry->idx, ZONE_TYPE), 266 __entry->order, 255 __entry->order, 267 __entry->order_failed, 256 __entry->order_failed, 268 __entry->considered, 257 __entry->considered, 269 1UL << __entry->defer_shift) 258 1UL << __entry->defer_shift) 270 ); 259 ); 271 260 272 DEFINE_EVENT(mm_compaction_defer_template, mm_ 261 DEFINE_EVENT(mm_compaction_defer_template, mm_compaction_deferred, 273 262 274 TP_PROTO(struct zone *zone, int order) 263 TP_PROTO(struct zone *zone, int order), 275 264 276 TP_ARGS(zone, order) 265 TP_ARGS(zone, order) 277 ); 266 ); 278 267 279 DEFINE_EVENT(mm_compaction_defer_template, mm_ 268 DEFINE_EVENT(mm_compaction_defer_template, mm_compaction_defer_compaction, 280 269 281 TP_PROTO(struct zone *zone, int order) 270 TP_PROTO(struct zone *zone, int order), 282 271 283 TP_ARGS(zone, order) 272 TP_ARGS(zone, order) 284 ); 273 ); 285 274 286 DEFINE_EVENT(mm_compaction_defer_template, mm_ 275 DEFINE_EVENT(mm_compaction_defer_template, mm_compaction_defer_reset, 287 276 288 TP_PROTO(struct zone *zone, int order) 277 TP_PROTO(struct zone *zone, int order), 289 278 290 TP_ARGS(zone, order) 279 TP_ARGS(zone, order) 291 ); 280 ); 292 281 293 TRACE_EVENT(mm_compaction_kcompactd_sleep, 282 TRACE_EVENT(mm_compaction_kcompactd_sleep, 294 283 295 TP_PROTO(int nid), 284 TP_PROTO(int nid), 296 285 297 TP_ARGS(nid), 286 TP_ARGS(nid), 298 287 299 TP_STRUCT__entry( 288 TP_STRUCT__entry( 300 __field(int, nid) 289 __field(int, nid) 301 ), 290 ), 302 291 303 TP_fast_assign( 292 TP_fast_assign( 304 __entry->nid = nid; 293 __entry->nid = nid; 305 ), 294 ), 306 295 307 TP_printk("nid=%d", __entry->nid) 296 TP_printk("nid=%d", __entry->nid) 308 ); 297 ); 309 298 310 DECLARE_EVENT_CLASS(kcompactd_wake_template, 299 DECLARE_EVENT_CLASS(kcompactd_wake_template, 311 300 312 TP_PROTO(int nid, int order, enum zone 301 TP_PROTO(int nid, int order, enum zone_type highest_zoneidx), 313 302 314 TP_ARGS(nid, order, highest_zoneidx), 303 TP_ARGS(nid, order, highest_zoneidx), 315 304 316 TP_STRUCT__entry( 305 TP_STRUCT__entry( 317 __field(int, nid) 306 __field(int, nid) 318 __field(int, order) 307 __field(int, order) 319 __field(enum zone_type, highes 308 __field(enum zone_type, highest_zoneidx) 320 ), 309 ), 321 310 322 TP_fast_assign( 311 TP_fast_assign( 323 __entry->nid = nid; 312 __entry->nid = nid; 324 __entry->order = order; 313 __entry->order = order; 325 __entry->highest_zoneidx = hig 314 __entry->highest_zoneidx = highest_zoneidx; 326 ), 315 ), 327 316 328 /* 317 /* 329 * classzone_idx is previous name of t 318 * classzone_idx is previous name of the highest_zoneidx. 330 * Reason not to change it is the ABI 319 * Reason not to change it is the ABI requirement of the tracepoint. 331 */ 320 */ 332 TP_printk("nid=%d order=%d classzone_i 321 TP_printk("nid=%d order=%d classzone_idx=%-8s", 333 __entry->nid, 322 __entry->nid, 334 __entry->order, 323 __entry->order, 335 __print_symbolic(__entry->high 324 __print_symbolic(__entry->highest_zoneidx, ZONE_TYPE)) 336 ); 325 ); 337 326 338 DEFINE_EVENT(kcompactd_wake_template, mm_compa 327 DEFINE_EVENT(kcompactd_wake_template, mm_compaction_wakeup_kcompactd, 339 328 340 TP_PROTO(int nid, int order, enum zone 329 TP_PROTO(int nid, int order, enum zone_type highest_zoneidx), 341 330 342 TP_ARGS(nid, order, highest_zoneidx) 331 TP_ARGS(nid, order, highest_zoneidx) 343 ); 332 ); 344 333 345 DEFINE_EVENT(kcompactd_wake_template, mm_compa 334 DEFINE_EVENT(kcompactd_wake_template, mm_compaction_kcompactd_wake, 346 335 347 TP_PROTO(int nid, int order, enum zone 336 TP_PROTO(int nid, int order, enum zone_type highest_zoneidx), 348 337 349 TP_ARGS(nid, order, highest_zoneidx) 338 TP_ARGS(nid, order, highest_zoneidx) 350 ); 339 ); 351 #endif 340 #endif 352 341 353 #endif /* _TRACE_COMPACTION_H */ 342 #endif /* _TRACE_COMPACTION_H */ 354 343 355 /* This part must be outside protection */ 344 /* This part must be outside protection */ 356 #include <trace/define_trace.h> 345 #include <trace/define_trace.h> 357 346
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.