| 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 | #undef TRACE_SYSTEM |
| 3 | #define TRACE_SYSTEM compaction |
| 4 | |
| 5 | #if !defined(LTTNG_TRACE_COMPACTION_H) || defined(TRACE_HEADER_MULTI_READ) |
| 6 | #define LTTNG_TRACE_COMPACTION_H |
| 7 | |
| 8 | #include <probes/lttng-tracepoint-event.h> |
| 9 | #include <linux/types.h> |
| 10 | |
| 11 | LTTNG_TRACEPOINT_EVENT_CLASS(compaction_isolate_template, |
| 12 | |
| 13 | TP_PROTO(unsigned long start_pfn, |
| 14 | unsigned long end_pfn, |
| 15 | unsigned long nr_scanned, |
| 16 | unsigned long nr_taken), |
| 17 | |
| 18 | TP_ARGS(start_pfn, end_pfn, nr_scanned, nr_taken), |
| 19 | |
| 20 | TP_FIELDS( |
| 21 | ctf_integer(unsigned long, start_pfn, start_pfn) |
| 22 | ctf_integer(unsigned long, end_pfn, end_pfn) |
| 23 | ctf_integer(unsigned long, nr_scanned, nr_scanned) |
| 24 | ctf_integer(unsigned long, nr_taken, nr_taken) |
| 25 | ) |
| 26 | ) |
| 27 | |
| 28 | LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(compaction_isolate_template, |
| 29 | |
| 30 | mm_compaction_isolate_migratepages, |
| 31 | |
| 32 | compaction_isolate_migratepages, |
| 33 | |
| 34 | TP_PROTO(unsigned long start_pfn, |
| 35 | unsigned long end_pfn, |
| 36 | unsigned long nr_scanned, |
| 37 | unsigned long nr_taken), |
| 38 | |
| 39 | TP_ARGS(start_pfn, end_pfn, nr_scanned, nr_taken) |
| 40 | ) |
| 41 | |
| 42 | LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(compaction_isolate_template, |
| 43 | |
| 44 | mm_compaction_isolate_freepages, |
| 45 | |
| 46 | compaction_isolate_freepages, |
| 47 | |
| 48 | TP_PROTO(unsigned long start_pfn, |
| 49 | unsigned long end_pfn, |
| 50 | unsigned long nr_scanned, |
| 51 | unsigned long nr_taken), |
| 52 | |
| 53 | TP_ARGS(start_pfn, end_pfn, nr_scanned, nr_taken) |
| 54 | ) |
| 55 | |
| 56 | LTTNG_TRACEPOINT_EVENT_CODE_MAP(mm_compaction_migratepages, |
| 57 | |
| 58 | compaction_migratepages, |
| 59 | |
| 60 | TP_PROTO(unsigned long nr_all, |
| 61 | int migrate_rc, |
| 62 | struct list_head *migratepages), |
| 63 | |
| 64 | TP_ARGS(nr_all, migrate_rc, migratepages), |
| 65 | |
| 66 | TP_locvar( |
| 67 | unsigned long nr_failed; |
| 68 | ), |
| 69 | |
| 70 | TP_code_pre( |
| 71 | tp_locvar->nr_failed = 0; |
| 72 | |
| 73 | { |
| 74 | struct list_head *page_lru; |
| 75 | |
| 76 | if (migrate_rc >= 0) |
| 77 | tp_locvar->nr_failed = migrate_rc; |
| 78 | else |
| 79 | list_for_each(page_lru, migratepages) |
| 80 | tp_locvar->nr_failed++; |
| 81 | } |
| 82 | ), |
| 83 | |
| 84 | TP_FIELDS( |
| 85 | ctf_integer(unsigned long, nr_migrated, nr_all - tp_locvar->nr_failed) |
| 86 | ctf_integer(unsigned long, nr_failed, tp_locvar->nr_failed) |
| 87 | ), |
| 88 | |
| 89 | TP_code_post() |
| 90 | ) |
| 91 | |
| 92 | #endif /* LTTNG_TRACE_COMPACTION_H */ |
| 93 | |
| 94 | /* This part must be outside protection */ |
| 95 | #include <probes/define_trace.h> |