Sync `show_inode_state()` macro with upstream stable kernels
[lttng-modules.git] / include / instrumentation / events / kmem.h
CommitLineData
b7cdc182 1/* SPDX-License-Identifier: GPL-2.0-only */
b283666f
PW
2#undef TRACE_SYSTEM
3#define TRACE_SYSTEM kmem
4
3bc29f0a
MD
5#if !defined(LTTNG_TRACE_KMEM_H) || defined(TRACE_HEADER_MULTI_READ)
6#define LTTNG_TRACE_KMEM_H
b283666f 7
3b4aafcb 8#include <lttng/tracepoint-event.h>
7c68b363 9#include <linux/types.h>
5f4c791e 10#include <lttng/kernel-version.h>
7c68b363 11
3bc29f0a 12LTTNG_TRACEPOINT_EVENT_CLASS(kmem_alloc,
b283666f
PW
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
f127e61e
MD
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 )
b283666f
PW
29)
30
3bc29f0a 31LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(kmem_alloc, kmalloc,
9cf29d3e
MD
32
33 kmem_kmalloc,
b283666f
PW
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
3bc29f0a 41LTTNG_TRACEPOINT_EVENT_INSTANCE(kmem_alloc, kmem_cache_alloc,
b283666f
PW
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
3bc29f0a 49LTTNG_TRACEPOINT_EVENT_CLASS(kmem_alloc_node,
b283666f
PW
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
f127e61e
MD
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 )
b283666f
PW
68)
69
3bc29f0a 70LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(kmem_alloc_node, kmalloc_node,
9cf29d3e
MD
71
72 kmem_kmalloc_node,
b283666f
PW
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
3bc29f0a 81LTTNG_TRACEPOINT_EVENT_INSTANCE(kmem_alloc_node, kmem_cache_alloc_node,
b283666f
PW
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
a8bc8ae5 90#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,12,0))
e7c9f1a9
HZ
91LTTNG_TRACEPOINT_EVENT_MAP(kfree,
92
93 kmem_kfree,
a8bc8ae5
MJ
94
95 TP_PROTO(unsigned long call_site, const void *ptr),
96
97 TP_ARGS(call_site, ptr),
98
99 TP_FIELDS(
100 ctf_integer_hex(unsigned long, call_site, call_site)
101 ctf_integer_hex(const void *, ptr, ptr)
102 )
103)
104
105LTTNG_TRACEPOINT_EVENT(kmem_cache_free,
106
107 TP_PROTO(unsigned long call_site, const void *ptr, const char *name),
108
109 TP_ARGS(call_site, ptr, name),
110
111 TP_FIELDS(
112 ctf_integer_hex(unsigned long, call_site, call_site)
113 ctf_integer_hex(const void *, ptr, ptr)
114 ctf_string(name, name)
115 )
116)
117#else
3bc29f0a 118LTTNG_TRACEPOINT_EVENT_CLASS(kmem_free,
b283666f
PW
119
120 TP_PROTO(unsigned long call_site, const void *ptr),
121
122 TP_ARGS(call_site, ptr),
123
f127e61e
MD
124 TP_FIELDS(
125 ctf_integer_hex(unsigned long, call_site, call_site)
126 ctf_integer_hex(const void *, ptr, ptr)
127 )
b283666f
PW
128)
129
3bc29f0a 130LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(kmem_free, kfree,
9cf29d3e
MD
131
132 kmem_kfree,
b283666f
PW
133
134 TP_PROTO(unsigned long call_site, const void *ptr),
135
136 TP_ARGS(call_site, ptr)
137)
138
3bc29f0a 139LTTNG_TRACEPOINT_EVENT_INSTANCE(kmem_free, kmem_cache_free,
b283666f
PW
140
141 TP_PROTO(unsigned long call_site, const void *ptr),
142
143 TP_ARGS(call_site, ptr)
144)
a8bc8ae5 145#endif
b283666f 146
5f4c791e 147#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,3,0))
9bbf98da 148LTTNG_TRACEPOINT_EVENT_MAP(mm_page_free, kmem_mm_page_free,
7c68b363 149#else
9bbf98da 150LTTNG_TRACEPOINT_EVENT_MAP(mm_page_free_direct, kmem_mm_page_free_direct,
7c68b363 151#endif
b283666f
PW
152
153 TP_PROTO(struct page *page, unsigned int order),
154
155 TP_ARGS(page, order),
156
f127e61e
MD
157 TP_FIELDS(
158 ctf_integer_hex(struct page *, page, page)
d1cf842b 159 ctf_integer(unsigned long, pfn, page_to_pfn(page))
f127e61e
MD
160 ctf_integer(unsigned int, order, order)
161 )
b283666f
PW
162)
163
5f4c791e 164#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,15,0))
071c76b5
MJ
165LTTNG_TRACEPOINT_EVENT_MAP(mm_page_free_batched, kmem_mm_page_free_batched,
166
167 TP_PROTO(struct page *page),
168
169 TP_ARGS(page),
170
171 TP_FIELDS(
172 ctf_integer_hex(struct page *, page, page)
173 ctf_integer(unsigned long, pfn, page_to_pfn(page))
174 )
175)
5f4c791e 176#elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,3,0))
9bbf98da 177LTTNG_TRACEPOINT_EVENT_MAP(mm_page_free_batched, kmem_mm_page_free_batched,
071c76b5
MJ
178
179 TP_PROTO(struct page *page, int cold),
180
181 TP_ARGS(page, cold),
182
183 TP_FIELDS(
184 ctf_integer_hex(struct page *, page, page)
185 ctf_integer(unsigned long, pfn, page_to_pfn(page))
186 ctf_integer(int, cold, cold)
187 )
188)
7c68b363 189#else
9bbf98da 190LTTNG_TRACEPOINT_EVENT_MAP(mm_pagevec_free, kmem_pagevec_free,
b283666f
PW
191
192 TP_PROTO(struct page *page, int cold),
193
194 TP_ARGS(page, cold),
195
f127e61e
MD
196 TP_FIELDS(
197 ctf_integer_hex(struct page *, page, page)
d1cf842b 198 ctf_integer(unsigned long, pfn, page_to_pfn(page))
f127e61e
MD
199 ctf_integer(int, cold, cold)
200 )
b283666f 201)
071c76b5 202#endif
b283666f 203
9bbf98da 204LTTNG_TRACEPOINT_EVENT_MAP(mm_page_alloc, kmem_mm_page_alloc,
b283666f
PW
205
206 TP_PROTO(struct page *page, unsigned int order,
207 gfp_t gfp_flags, int migratetype),
208
209 TP_ARGS(page, order, gfp_flags, migratetype),
210
f127e61e
MD
211 TP_FIELDS(
212 ctf_integer_hex(struct page *, page, page)
d1cf842b
MD
213 ctf_integer(unsigned long, pfn,
214 page ? page_to_pfn(page) : -1UL)
f127e61e
MD
215 ctf_integer(unsigned int, order, order)
216 ctf_integer(gfp_t, gfp_flags, gfp_flags)
217 ctf_integer(int, migratetype, migratetype)
218 )
b283666f
PW
219)
220
9bbf98da 221LTTNG_TRACEPOINT_EVENT_CLASS(kmem_mm_page,
b283666f
PW
222
223 TP_PROTO(struct page *page, unsigned int order, int migratetype),
224
225 TP_ARGS(page, order, migratetype),
226
f127e61e
MD
227 TP_FIELDS(
228 ctf_integer_hex(struct page *, page, page)
d1cf842b
MD
229 ctf_integer(unsigned long, pfn,
230 page ? page_to_pfn(page) : -1UL)
f127e61e
MD
231 ctf_integer(unsigned int, order, order)
232 ctf_integer(int, migratetype, migratetype)
233 )
b283666f
PW
234)
235
9bbf98da
MD
236LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(kmem_mm_page, mm_page_alloc_zone_locked,
237
238 kmem_mm_page_alloc_zone_locked,
b283666f
PW
239
240 TP_PROTO(struct page *page, unsigned int order, int migratetype),
241
242 TP_ARGS(page, order, migratetype)
243)
244
f127e61e 245LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(kmem_mm_page, mm_page_pcpu_drain,
9bbf98da
MD
246
247 kmem_mm_page_pcpu_drain,
b283666f
PW
248
249 TP_PROTO(struct page *page, unsigned int order, int migratetype),
250
f127e61e 251 TP_ARGS(page, order, migratetype)
b283666f
PW
252)
253
5f4c791e 254#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,19,2) \
72e6c528 255 || LTTNG_KERNEL_RANGE(3,14,36, 3,15,0) \
83884c09 256 || LTTNG_KERNEL_RANGE(3,16,35, 3,17,0) \
f1b58fb1 257 || LTTNG_KERNEL_RANGE(3,18,10, 3,19,0) \
72906e12 258 || LTTNG_DEBIAN_KERNEL_RANGE(3,16,7,9,0,0, 3,17,0,0,0,0) \
f8996f1b 259 || LTTNG_UBUNTU_KERNEL_RANGE(3,13,11,50, 3,14,0,0) \
472b44c2 260 || LTTNG_UBUNTU_KERNEL_RANGE(3,16,7,34, 3,17,0,0))
2cf0c2ca 261
7c9c39d2
MD
262LTTNG_TRACEPOINT_EVENT_MAP(mm_page_alloc_extfrag,
263
264 kmem_mm_page_alloc_extfrag,
2cf0c2ca
MD
265
266 TP_PROTO(struct page *page,
267 int alloc_order, int fallback_order,
268 int alloc_migratetype, int fallback_migratetype),
269
270 TP_ARGS(page,
271 alloc_order, fallback_order,
272 alloc_migratetype, fallback_migratetype),
273
c94b360d
MD
274 TP_FIELDS(
275 ctf_integer_hex(struct page *, page, page)
d1cf842b 276 ctf_integer(unsigned long, pfn, page_to_pfn(page))
c94b360d
MD
277 ctf_integer(int, alloc_order, alloc_order)
278 ctf_integer(int, fallback_order, fallback_order)
279 ctf_integer(int, alloc_migratetype, alloc_migratetype)
280 ctf_integer(int, fallback_migratetype, fallback_migratetype)
281 ctf_integer(int, change_ownership,
2cf0c2ca 282 (alloc_migratetype == get_pageblock_migratetype(page)))
c94b360d 283 )
2cf0c2ca
MD
284)
285
5f4c791e 286#elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,12,30))
8b831331 287
7c9c39d2
MD
288LTTNG_TRACEPOINT_EVENT_MAP(mm_page_alloc_extfrag,
289
290 kmem_mm_page_alloc_extfrag,
8b831331
MD
291
292 TP_PROTO(struct page *page,
293 int alloc_order, int fallback_order,
294 int alloc_migratetype, int fallback_migratetype, int new_migratetype),
295
296 TP_ARGS(page,
297 alloc_order, fallback_order,
298 alloc_migratetype, fallback_migratetype, new_migratetype),
299
c94b360d
MD
300 TP_FIELDS(
301 ctf_integer_hex(struct page *, page, page)
d1cf842b 302 ctf_integer(unsigned long, pfn, page_to_pfn(page))
c94b360d
MD
303 ctf_integer(int, alloc_order, alloc_order)
304 ctf_integer(int, fallback_order, fallback_order)
305 ctf_integer(int, alloc_migratetype, alloc_migratetype)
306 ctf_integer(int, fallback_migratetype, fallback_migratetype)
307 ctf_integer(int, change_ownership, (new_migratetype == alloc_migratetype))
308 )
8b831331
MD
309)
310
5f4c791e 311#elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,12,0))
926b9256 312
9bbf98da
MD
313LTTNG_TRACEPOINT_EVENT_MAP(mm_page_alloc_extfrag,
314
315 kmem_mm_page_alloc_extfrag,
926b9256
MD
316
317 TP_PROTO(struct page *page,
318 int alloc_order, int fallback_order,
319 int alloc_migratetype, int fallback_migratetype,
320 int change_ownership),
321
322 TP_ARGS(page,
323 alloc_order, fallback_order,
324 alloc_migratetype, fallback_migratetype,
325 change_ownership),
326
f127e61e
MD
327 TP_FIELDS(
328 ctf_integer_hex(struct page *, page, page)
d1cf842b 329 ctf_integer(unsigned long, pfn, page_to_pfn(page))
f127e61e
MD
330 ctf_integer(int, alloc_order, alloc_order)
331 ctf_integer(int, fallback_order, fallback_order)
332 ctf_integer(int, alloc_migratetype, alloc_migratetype)
333 ctf_integer(int, fallback_migratetype, fallback_migratetype)
334 ctf_integer(int, change_ownership, change_ownership)
335 )
926b9256
MD
336)
337
5f4c791e 338#else /* #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,12,0)) */
926b9256 339
9bbf98da
MD
340LTTNG_TRACEPOINT_EVENT_MAP(mm_page_alloc_extfrag,
341
342 kmem_mm_page_alloc_extfrag,
b283666f
PW
343
344 TP_PROTO(struct page *page,
345 int alloc_order, int fallback_order,
346 int alloc_migratetype, int fallback_migratetype),
347
348 TP_ARGS(page,
349 alloc_order, fallback_order,
350 alloc_migratetype, fallback_migratetype),
351
f127e61e
MD
352 TP_FIELDS(
353 ctf_integer_hex(struct page *, page, page)
d1cf842b 354 ctf_integer(unsigned long, pfn, page_to_pfn(page))
f127e61e
MD
355 ctf_integer(int, alloc_order, alloc_order)
356 ctf_integer(int, fallback_order, fallback_order)
357 ctf_integer(int, alloc_migratetype, alloc_migratetype)
358 ctf_integer(int, fallback_migratetype, fallback_migratetype)
359 )
b283666f 360)
926b9256 361
5f4c791e 362#endif /* #else #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,12,0)) */
926b9256 363
3bc29f0a 364#endif /* LTTNG_TRACE_KMEM_H */
b283666f
PW
365
366/* This part must be outside protection */
3b4aafcb 367#include <lttng/define_trace.h>
This page took 0.068557 seconds and 4 git commands to generate.