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