Commit | Line | Data |
---|---|---|
b7cdc182 | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
b87700e3 AG |
2 | #undef TRACE_SYSTEM |
3 | #define TRACE_SYSTEM compaction | |
4 | ||
3bc29f0a MD |
5 | #if !defined(LTTNG_TRACE_COMPACTION_H) || defined(TRACE_HEADER_MULTI_READ) |
6 | #define LTTNG_TRACE_COMPACTION_H | |
b87700e3 | 7 | |
3b4aafcb | 8 | #include <lttng/tracepoint-event.h> |
b87700e3 | 9 | #include <linux/types.h> |
5f4c791e | 10 | #include <lttng/kernel-version.h> |
b87700e3 | 11 | |
9bbf98da | 12 | LTTNG_TRACEPOINT_EVENT_CLASS(compaction_isolate_template, |
a57f014e MD |
13 | |
14 | TP_PROTO(unsigned long start_pfn, | |
15 | unsigned long end_pfn, | |
16 | unsigned long nr_scanned, | |
17 | unsigned long nr_taken), | |
18 | ||
19 | TP_ARGS(start_pfn, end_pfn, nr_scanned, nr_taken), | |
20 | ||
f127e61e MD |
21 | TP_FIELDS( |
22 | ctf_integer(unsigned long, start_pfn, start_pfn) | |
23 | ctf_integer(unsigned long, end_pfn, end_pfn) | |
24 | ctf_integer(unsigned long, nr_scanned, nr_scanned) | |
25 | ctf_integer(unsigned long, nr_taken, nr_taken) | |
26 | ) | |
a57f014e MD |
27 | ) |
28 | ||
c3857419 MD |
29 | LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(compaction_isolate_template, |
30 | ||
31 | mm_compaction_isolate_migratepages, | |
32 | ||
33 | compaction_isolate_migratepages, | |
a57f014e MD |
34 | |
35 | TP_PROTO(unsigned long start_pfn, | |
36 | unsigned long end_pfn, | |
37 | unsigned long nr_scanned, | |
38 | unsigned long nr_taken), | |
39 | ||
40 | TP_ARGS(start_pfn, end_pfn, nr_scanned, nr_taken) | |
41 | ) | |
42 | ||
c3857419 MD |
43 | LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(compaction_isolate_template, |
44 | ||
45 | mm_compaction_isolate_freepages, | |
46 | ||
47 | compaction_isolate_freepages, | |
a57f014e MD |
48 | |
49 | TP_PROTO(unsigned long start_pfn, | |
50 | unsigned long end_pfn, | |
51 | unsigned long nr_scanned, | |
52 | unsigned long nr_taken), | |
53 | ||
54 | TP_ARGS(start_pfn, end_pfn, nr_scanned, nr_taken) | |
55 | ) | |
56 | ||
a9d49ac6 MH |
57 | #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,18,0) || \ |
58 | LTTNG_RHEL_KERNEL_RANGE(5,14,0,163,0,0, 5,15,0,0,0,0)) | |
f9208dc0 MJ |
59 | LTTNG_TRACEPOINT_EVENT_MAP(mm_compaction_migratepages, |
60 | ||
61 | compaction_migratepages, | |
62 | ||
63 | TP_PROTO(struct compact_control *cc, | |
64 | unsigned int nr_succeeded), | |
65 | ||
66 | TP_ARGS(cc, nr_succeeded), | |
67 | ||
68 | TP_FIELDS( | |
69 | ctf_integer(unsigned long, nr_migrated, nr_succeeded) | |
70 | ctf_integer(unsigned long, nr_failed, cc->nr_migratepages - nr_succeeded) | |
71 | ) | |
72 | ) | |
73 | #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,17,0)) | |
c312bda0 MD |
74 | LTTNG_TRACEPOINT_EVENT_MAP(mm_compaction_migratepages, |
75 | ||
76 | compaction_migratepages, | |
a9b832ac MJ |
77 | |
78 | TP_PROTO(unsigned long nr_all, | |
79 | unsigned int nr_succeeded), | |
80 | ||
81 | TP_ARGS(nr_all, nr_succeeded), | |
82 | ||
83 | TP_FIELDS( | |
84 | ctf_integer(unsigned long, nr_migrated, nr_succeeded) | |
85 | ctf_integer(unsigned long, nr_failed, nr_all - nr_succeeded) | |
86 | ) | |
87 | ) | |
441e0d16 | 88 | #else |
f127e61e | 89 | LTTNG_TRACEPOINT_EVENT_CODE_MAP(mm_compaction_migratepages, |
9bbf98da MD |
90 | |
91 | compaction_migratepages, | |
00073447 MD |
92 | |
93 | TP_PROTO(unsigned long nr_all, | |
94 | int migrate_rc, | |
95 | struct list_head *migratepages), | |
96 | ||
97 | TP_ARGS(nr_all, migrate_rc, migratepages), | |
98 | ||
f127e61e MD |
99 | TP_locvar( |
100 | unsigned long nr_failed; | |
00073447 MD |
101 | ), |
102 | ||
265822ae | 103 | TP_code_pre( |
f127e61e MD |
104 | tp_locvar->nr_failed = 0; |
105 | ||
106 | { | |
107 | struct list_head *page_lru; | |
108 | ||
109 | if (migrate_rc >= 0) | |
110 | tp_locvar->nr_failed = migrate_rc; | |
111 | else | |
112 | list_for_each(page_lru, migratepages) | |
113 | tp_locvar->nr_failed++; | |
114 | } | |
00073447 MD |
115 | ), |
116 | ||
f127e61e MD |
117 | TP_FIELDS( |
118 | ctf_integer(unsigned long, nr_migrated, nr_all - tp_locvar->nr_failed) | |
119 | ctf_integer(unsigned long, nr_failed, tp_locvar->nr_failed) | |
265822ae MD |
120 | ), |
121 | ||
122 | TP_code_post() | |
00073447 | 123 | ) |
5f4c791e | 124 | #endif /* #else #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,16,0)) */ |
b87700e3 | 125 | |
3bc29f0a | 126 | #endif /* LTTNG_TRACE_COMPACTION_H */ |
b87700e3 AG |
127 | |
128 | /* This part must be outside protection */ | |
3b4aafcb | 129 | #include <lttng/define_trace.h> |