Fix: mm_compaction_migratepages changed in linux 6.9-rc1
[lttng-modules.git] / include / instrumentation / events / compaction.h
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 <lttng/tracepoint-event.h>
9 #include <linux/types.h>
10 #include <lttng/kernel-version.h>
11
12 #if LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,0,0)
13
14 LTTNG_TRACEPOINT_EVENT_CLASS(compaction_isolate_template,
15
16 TP_PROTO(unsigned long start_pfn,
17 unsigned long end_pfn,
18 unsigned long nr_scanned,
19 unsigned long nr_taken),
20
21 TP_ARGS(start_pfn, end_pfn, nr_scanned, nr_taken),
22
23 TP_FIELDS(
24 ctf_integer(unsigned long, start_pfn, start_pfn)
25 ctf_integer(unsigned long, end_pfn, end_pfn)
26 ctf_integer(unsigned long, nr_scanned, nr_scanned)
27 ctf_integer(unsigned long, nr_taken, nr_taken)
28 )
29 )
30
31 LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(compaction_isolate_template,
32
33 mm_compaction_isolate_migratepages,
34
35 compaction_isolate_migratepages,
36
37 TP_PROTO(unsigned long start_pfn,
38 unsigned long end_pfn,
39 unsigned long nr_scanned,
40 unsigned long nr_taken),
41
42 TP_ARGS(start_pfn, end_pfn, nr_scanned, nr_taken)
43 )
44
45 LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(compaction_isolate_template,
46
47 mm_compaction_isolate_freepages,
48
49 compaction_isolate_freepages,
50
51 TP_PROTO(unsigned long start_pfn,
52 unsigned long end_pfn,
53 unsigned long nr_scanned,
54 unsigned long nr_taken),
55
56 TP_ARGS(start_pfn, end_pfn, nr_scanned, nr_taken)
57 )
58
59 #else /* #if LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,0,0) */
60
61 LTTNG_TRACEPOINT_EVENT_CLASS(compaction_isolate_template,
62
63 TP_PROTO(unsigned long nr_scanned,
64 unsigned long nr_taken),
65
66 TP_ARGS(nr_scanned, nr_taken),
67
68 TP_FIELDS(
69 ctf_integer(unsigned long, nr_scanned, nr_scanned)
70 ctf_integer(unsigned long, nr_taken, nr_taken)
71 )
72 )
73
74 LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(compaction_isolate_template,
75
76 mm_compaction_isolate_migratepages,
77
78 compaction_isolate_migratepages,
79
80 TP_PROTO(unsigned long nr_scanned,
81 unsigned long nr_taken),
82
83 TP_ARGS(nr_scanned, nr_taken)
84 )
85
86 LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(compaction_isolate_template,
87
88 mm_compaction_isolate_freepages,
89
90 compaction_isolate_freepages,
91
92 TP_PROTO(unsigned long nr_scanned,
93 unsigned long nr_taken),
94
95 TP_ARGS(nr_scanned, nr_taken)
96 )
97
98 #endif /* #else #if LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,0,0) */
99
100 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(6,9,0))
101 LTTNG_TRACEPOINT_EVENT_MAP(mm_compaction_migratepages,
102
103 compaction_migratepages,
104
105 TP_PROTO(unsigned int nr_migratepages,
106 unsigned int nr_succeeded),
107
108 TP_ARGS(nr_migratepages, nr_succeeded),
109
110 TP_FIELDS(
111 ctf_integer(unsigned long, nr_migrated, nr_succeeded)
112 ctf_integer(unsigned long, nr_failed, nr_migratepages - nr_succeeded)
113 )
114 )
115 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,18,0) || \
116 LTTNG_RHEL_KERNEL_RANGE(5,14,0,163,0,0, 5,15,0,0,0,0))
117 LTTNG_TRACEPOINT_EVENT_MAP(mm_compaction_migratepages,
118
119 compaction_migratepages,
120
121 TP_PROTO(struct compact_control *cc,
122 unsigned int nr_succeeded),
123
124 TP_ARGS(cc, nr_succeeded),
125
126 TP_FIELDS(
127 ctf_integer(unsigned long, nr_migrated, nr_succeeded)
128 ctf_integer(unsigned long, nr_failed, cc->nr_migratepages - nr_succeeded)
129 )
130 )
131 #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,17,0))
132 LTTNG_TRACEPOINT_EVENT_MAP(mm_compaction_migratepages,
133
134 compaction_migratepages,
135
136 TP_PROTO(unsigned long nr_all,
137 unsigned int nr_succeeded),
138
139 TP_ARGS(nr_all, nr_succeeded),
140
141 TP_FIELDS(
142 ctf_integer(unsigned long, nr_migrated, nr_succeeded)
143 ctf_integer(unsigned long, nr_failed, nr_all - nr_succeeded)
144 )
145 )
146 #elif LTTNG_KERNEL_RANGE(3,12,30, 3,13,0) || \
147 LTTNG_KERNEL_RANGE(3,14,25, 3,15,0) || \
148 (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,16,0))
149 LTTNG_TRACEPOINT_EVENT_CODE_MAP(mm_compaction_migratepages,
150
151 compaction_migratepages,
152
153 TP_PROTO(unsigned long nr_all,
154 int migrate_rc,
155 struct list_head *migratepages),
156
157 TP_ARGS(nr_all, migrate_rc, migratepages),
158
159 TP_locvar(
160 unsigned long nr_failed;
161 ),
162
163 TP_code_pre(
164 tp_locvar->nr_failed = 0;
165
166 {
167 struct list_head *page_lru;
168
169 if (migrate_rc >= 0)
170 tp_locvar->nr_failed = migrate_rc;
171 else
172 list_for_each(page_lru, migratepages)
173 tp_locvar->nr_failed++;
174 }
175 ),
176
177 TP_FIELDS(
178 ctf_integer(unsigned long, nr_migrated, nr_all - tp_locvar->nr_failed)
179 ctf_integer(unsigned long, nr_failed, tp_locvar->nr_failed)
180 ),
181
182 TP_code_post()
183 )
184 #else /* #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,16,0)) */
185 LTTNG_TRACEPOINT_EVENT_MAP(mm_compaction_migratepages,
186
187 compaction_migratepages,
188
189 TP_PROTO(unsigned long nr_migrated,
190 unsigned long nr_failed),
191
192 TP_ARGS(nr_migrated, nr_failed),
193
194 TP_FIELDS(
195 ctf_integer(unsigned long, nr_migrated, nr_migrated)
196 ctf_integer(unsigned long, nr_failed, nr_failed)
197 )
198 )
199 #endif /* #else #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,16,0)) */
200
201 #endif /* LTTNG_TRACE_COMPACTION_H */
202
203 /* This part must be outside protection */
204 #include <lttng/define_trace.h>
This page took 0.03385 seconds and 4 git commands to generate.