Drop support for kernels < 3.0 from kmem instrumentation
[lttng-modules.git] / instrumentation / events / lttng-module / kmem.h
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #undef TRACE_SYSTEM
3 #define TRACE_SYSTEM kmem
4
5 #if !defined(LTTNG_TRACE_KMEM_H) || defined(TRACE_HEADER_MULTI_READ)
6 #define LTTNG_TRACE_KMEM_H
7
8 #include <probes/lttng-tracepoint-event.h>
9 #include <linux/types.h>
10 #include <linux/version.h>
11
12 LTTNG_TRACEPOINT_EVENT_CLASS(kmem_alloc,
13
14 TP_PROTO(unsigned long call_site,
15 const void *ptr,
16 size_t bytes_req,
17 size_t bytes_alloc,
18 gfp_t gfp_flags),
19
20 TP_ARGS(call_site, ptr, bytes_req, bytes_alloc, gfp_flags),
21
22 TP_FIELDS(
23 ctf_integer_hex(unsigned long, call_site, call_site)
24 ctf_integer_hex(const void *, ptr, ptr)
25 ctf_integer(size_t, bytes_req, bytes_req)
26 ctf_integer(size_t, bytes_alloc, bytes_alloc)
27 ctf_integer(gfp_t, gfp_flags, gfp_flags)
28 )
29 )
30
31 LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(kmem_alloc, kmalloc,
32
33 kmem_kmalloc,
34
35 TP_PROTO(unsigned long call_site, const void *ptr,
36 size_t bytes_req, size_t bytes_alloc, gfp_t gfp_flags),
37
38 TP_ARGS(call_site, ptr, bytes_req, bytes_alloc, gfp_flags)
39 )
40
41 LTTNG_TRACEPOINT_EVENT_INSTANCE(kmem_alloc, kmem_cache_alloc,
42
43 TP_PROTO(unsigned long call_site, const void *ptr,
44 size_t bytes_req, size_t bytes_alloc, gfp_t gfp_flags),
45
46 TP_ARGS(call_site, ptr, bytes_req, bytes_alloc, gfp_flags)
47 )
48
49 LTTNG_TRACEPOINT_EVENT_CLASS(kmem_alloc_node,
50
51 TP_PROTO(unsigned long call_site,
52 const void *ptr,
53 size_t bytes_req,
54 size_t bytes_alloc,
55 gfp_t gfp_flags,
56 int node),
57
58 TP_ARGS(call_site, ptr, bytes_req, bytes_alloc, gfp_flags, node),
59
60 TP_FIELDS(
61 ctf_integer_hex(unsigned long, call_site, call_site)
62 ctf_integer_hex(const void *, ptr, ptr)
63 ctf_integer(size_t, bytes_req, bytes_req)
64 ctf_integer(size_t, bytes_alloc, bytes_alloc)
65 ctf_integer(gfp_t, gfp_flags, gfp_flags)
66 ctf_integer(int, node, node)
67 )
68 )
69
70 LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(kmem_alloc_node, kmalloc_node,
71
72 kmem_kmalloc_node,
73
74 TP_PROTO(unsigned long call_site, const void *ptr,
75 size_t bytes_req, size_t bytes_alloc,
76 gfp_t gfp_flags, int node),
77
78 TP_ARGS(call_site, ptr, bytes_req, bytes_alloc, gfp_flags, node)
79 )
80
81 LTTNG_TRACEPOINT_EVENT_INSTANCE(kmem_alloc_node, kmem_cache_alloc_node,
82
83 TP_PROTO(unsigned long call_site, const void *ptr,
84 size_t bytes_req, size_t bytes_alloc,
85 gfp_t gfp_flags, int node),
86
87 TP_ARGS(call_site, ptr, bytes_req, bytes_alloc, gfp_flags, node)
88 )
89
90 LTTNG_TRACEPOINT_EVENT_CLASS(kmem_free,
91
92 TP_PROTO(unsigned long call_site, const void *ptr),
93
94 TP_ARGS(call_site, ptr),
95
96 TP_FIELDS(
97 ctf_integer_hex(unsigned long, call_site, call_site)
98 ctf_integer_hex(const void *, ptr, ptr)
99 )
100 )
101
102 LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(kmem_free, kfree,
103
104 kmem_kfree,
105
106 TP_PROTO(unsigned long call_site, const void *ptr),
107
108 TP_ARGS(call_site, ptr)
109 )
110
111 LTTNG_TRACEPOINT_EVENT_INSTANCE(kmem_free, kmem_cache_free,
112
113 TP_PROTO(unsigned long call_site, const void *ptr),
114
115 TP_ARGS(call_site, ptr)
116 )
117
118 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0))
119 LTTNG_TRACEPOINT_EVENT_MAP(mm_page_free, kmem_mm_page_free,
120 #else
121 LTTNG_TRACEPOINT_EVENT_MAP(mm_page_free_direct, kmem_mm_page_free_direct,
122 #endif
123
124 TP_PROTO(struct page *page, unsigned int order),
125
126 TP_ARGS(page, order),
127
128 TP_FIELDS(
129 ctf_integer_hex(struct page *, page, page)
130 ctf_integer(unsigned long, pfn, page_to_pfn(page))
131 ctf_integer(unsigned int, order, order)
132 )
133 )
134
135 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,15,0))
136 LTTNG_TRACEPOINT_EVENT_MAP(mm_page_free_batched, kmem_mm_page_free_batched,
137
138 TP_PROTO(struct page *page),
139
140 TP_ARGS(page),
141
142 TP_FIELDS(
143 ctf_integer_hex(struct page *, page, page)
144 ctf_integer(unsigned long, pfn, page_to_pfn(page))
145 )
146 )
147 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0))
148 LTTNG_TRACEPOINT_EVENT_MAP(mm_page_free_batched, kmem_mm_page_free_batched,
149
150 TP_PROTO(struct page *page, int cold),
151
152 TP_ARGS(page, cold),
153
154 TP_FIELDS(
155 ctf_integer_hex(struct page *, page, page)
156 ctf_integer(unsigned long, pfn, page_to_pfn(page))
157 ctf_integer(int, cold, cold)
158 )
159 )
160 #else
161 LTTNG_TRACEPOINT_EVENT_MAP(mm_pagevec_free, kmem_pagevec_free,
162
163 TP_PROTO(struct page *page, int cold),
164
165 TP_ARGS(page, cold),
166
167 TP_FIELDS(
168 ctf_integer_hex(struct page *, page, page)
169 ctf_integer(unsigned long, pfn, page_to_pfn(page))
170 ctf_integer(int, cold, cold)
171 )
172 )
173 #endif
174
175 LTTNG_TRACEPOINT_EVENT_MAP(mm_page_alloc, kmem_mm_page_alloc,
176
177 TP_PROTO(struct page *page, unsigned int order,
178 gfp_t gfp_flags, int migratetype),
179
180 TP_ARGS(page, order, gfp_flags, migratetype),
181
182 TP_FIELDS(
183 ctf_integer_hex(struct page *, page, page)
184 ctf_integer(unsigned long, pfn,
185 page ? page_to_pfn(page) : -1UL)
186 ctf_integer(unsigned int, order, order)
187 ctf_integer(gfp_t, gfp_flags, gfp_flags)
188 ctf_integer(int, migratetype, migratetype)
189 )
190 )
191
192 LTTNG_TRACEPOINT_EVENT_CLASS(kmem_mm_page,
193
194 TP_PROTO(struct page *page, unsigned int order, int migratetype),
195
196 TP_ARGS(page, order, migratetype),
197
198 TP_FIELDS(
199 ctf_integer_hex(struct page *, page, page)
200 ctf_integer(unsigned long, pfn,
201 page ? page_to_pfn(page) : -1UL)
202 ctf_integer(unsigned int, order, order)
203 ctf_integer(int, migratetype, migratetype)
204 )
205 )
206
207 LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(kmem_mm_page, mm_page_alloc_zone_locked,
208
209 kmem_mm_page_alloc_zone_locked,
210
211 TP_PROTO(struct page *page, unsigned int order, int migratetype),
212
213 TP_ARGS(page, order, migratetype)
214 )
215
216 LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(kmem_mm_page, mm_page_pcpu_drain,
217
218 kmem_mm_page_pcpu_drain,
219
220 TP_PROTO(struct page *page, unsigned int order, int migratetype),
221
222 TP_ARGS(page, order, migratetype)
223 )
224
225 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,19,2) \
226 || LTTNG_KERNEL_RANGE(3,14,36, 3,15,0) \
227 || LTTNG_KERNEL_RANGE(3,16,35, 3,17,0) \
228 || LTTNG_KERNEL_RANGE(3,18,10, 3,19,0) \
229 || LTTNG_DEBIAN_KERNEL_RANGE(3,16,7,9,0,0, 3,17,0,0,0,0) \
230 || LTTNG_UBUNTU_KERNEL_RANGE(3,13,11,50, 3,14,0,0) \
231 || LTTNG_UBUNTU_KERNEL_RANGE(3,16,7,34, 3,17,0,0))
232
233 LTTNG_TRACEPOINT_EVENT_MAP(mm_page_alloc_extfrag,
234
235 kmem_mm_page_alloc_extfrag,
236
237 TP_PROTO(struct page *page,
238 int alloc_order, int fallback_order,
239 int alloc_migratetype, int fallback_migratetype),
240
241 TP_ARGS(page,
242 alloc_order, fallback_order,
243 alloc_migratetype, fallback_migratetype),
244
245 TP_FIELDS(
246 ctf_integer_hex(struct page *, page, page)
247 ctf_integer(unsigned long, pfn, page_to_pfn(page))
248 ctf_integer(int, alloc_order, alloc_order)
249 ctf_integer(int, fallback_order, fallback_order)
250 ctf_integer(int, alloc_migratetype, alloc_migratetype)
251 ctf_integer(int, fallback_migratetype, fallback_migratetype)
252 ctf_integer(int, change_ownership,
253 (alloc_migratetype == get_pageblock_migratetype(page)))
254 )
255 )
256
257 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,30))
258
259 LTTNG_TRACEPOINT_EVENT_MAP(mm_page_alloc_extfrag,
260
261 kmem_mm_page_alloc_extfrag,
262
263 TP_PROTO(struct page *page,
264 int alloc_order, int fallback_order,
265 int alloc_migratetype, int fallback_migratetype, int new_migratetype),
266
267 TP_ARGS(page,
268 alloc_order, fallback_order,
269 alloc_migratetype, fallback_migratetype, new_migratetype),
270
271 TP_FIELDS(
272 ctf_integer_hex(struct page *, page, page)
273 ctf_integer(unsigned long, pfn, page_to_pfn(page))
274 ctf_integer(int, alloc_order, alloc_order)
275 ctf_integer(int, fallback_order, fallback_order)
276 ctf_integer(int, alloc_migratetype, alloc_migratetype)
277 ctf_integer(int, fallback_migratetype, fallback_migratetype)
278 ctf_integer(int, change_ownership, (new_migratetype == alloc_migratetype))
279 )
280 )
281
282 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0))
283
284 LTTNG_TRACEPOINT_EVENT_MAP(mm_page_alloc_extfrag,
285
286 kmem_mm_page_alloc_extfrag,
287
288 TP_PROTO(struct page *page,
289 int alloc_order, int fallback_order,
290 int alloc_migratetype, int fallback_migratetype,
291 int change_ownership),
292
293 TP_ARGS(page,
294 alloc_order, fallback_order,
295 alloc_migratetype, fallback_migratetype,
296 change_ownership),
297
298 TP_FIELDS(
299 ctf_integer_hex(struct page *, page, page)
300 ctf_integer(unsigned long, pfn, page_to_pfn(page))
301 ctf_integer(int, alloc_order, alloc_order)
302 ctf_integer(int, fallback_order, fallback_order)
303 ctf_integer(int, alloc_migratetype, alloc_migratetype)
304 ctf_integer(int, fallback_migratetype, fallback_migratetype)
305 ctf_integer(int, change_ownership, change_ownership)
306 )
307 )
308
309 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0)) */
310
311 LTTNG_TRACEPOINT_EVENT_MAP(mm_page_alloc_extfrag,
312
313 kmem_mm_page_alloc_extfrag,
314
315 TP_PROTO(struct page *page,
316 int alloc_order, int fallback_order,
317 int alloc_migratetype, int fallback_migratetype),
318
319 TP_ARGS(page,
320 alloc_order, fallback_order,
321 alloc_migratetype, fallback_migratetype),
322
323 TP_FIELDS(
324 ctf_integer_hex(struct page *, page, page)
325 ctf_integer(unsigned long, pfn, page_to_pfn(page))
326 ctf_integer(int, alloc_order, alloc_order)
327 ctf_integer(int, fallback_order, fallback_order)
328 ctf_integer(int, alloc_migratetype, alloc_migratetype)
329 ctf_integer(int, fallback_migratetype, fallback_migratetype)
330 )
331 )
332
333 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0)) */
334
335 #endif /* LTTNG_TRACE_KMEM_H */
336
337 /* This part must be outside protection */
338 #include <probes/define_trace.h>
This page took 0.035203 seconds and 4 git commands to generate.