Fix: mm_page_alloc_extfrag instrumentation for kernel 3.16.35
[lttng-modules.git] / instrumentation / events / lttng-module / kmem.h
1 #undef TRACE_SYSTEM
2 #define TRACE_SYSTEM kmem
3
4 #if !defined(LTTNG_TRACE_KMEM_H) || defined(TRACE_HEADER_MULTI_READ)
5 #define LTTNG_TRACE_KMEM_H
6
7 #include "../../../probes/lttng-tracepoint-event.h"
8 #include <linux/types.h>
9 #include <linux/version.h>
10
11 LTTNG_TRACEPOINT_EVENT_CLASS(kmem_alloc,
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
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 )
28 )
29
30 LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(kmem_alloc, kmalloc,
31
32 kmem_kmalloc,
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
40 LTTNG_TRACEPOINT_EVENT_INSTANCE(kmem_alloc, kmem_cache_alloc,
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
48 LTTNG_TRACEPOINT_EVENT_CLASS(kmem_alloc_node,
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
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 )
67 )
68
69 LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(kmem_alloc_node, kmalloc_node,
70
71 kmem_kmalloc_node,
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
80 LTTNG_TRACEPOINT_EVENT_INSTANCE(kmem_alloc_node, kmem_cache_alloc_node,
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
89 LTTNG_TRACEPOINT_EVENT_CLASS(kmem_free,
90
91 TP_PROTO(unsigned long call_site, const void *ptr),
92
93 TP_ARGS(call_site, ptr),
94
95 TP_FIELDS(
96 ctf_integer_hex(unsigned long, call_site, call_site)
97 ctf_integer_hex(const void *, ptr, ptr)
98 )
99 )
100
101 LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(kmem_free, kfree,
102
103 kmem_kfree,
104
105 TP_PROTO(unsigned long call_site, const void *ptr),
106
107 TP_ARGS(call_site, ptr)
108 )
109
110 LTTNG_TRACEPOINT_EVENT_INSTANCE(kmem_free, kmem_cache_free,
111
112 TP_PROTO(unsigned long call_site, const void *ptr),
113
114 TP_ARGS(call_site, ptr)
115 )
116
117 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32))
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 int, order, order)
131 )
132 )
133
134 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0))
135 LTTNG_TRACEPOINT_EVENT_MAP(mm_page_free_batched, kmem_mm_page_free_batched,
136 #else
137 LTTNG_TRACEPOINT_EVENT_MAP(mm_pagevec_free, kmem_pagevec_free,
138 #endif
139
140 TP_PROTO(struct page *page, int cold),
141
142 TP_ARGS(page, cold),
143
144 TP_FIELDS(
145 ctf_integer_hex(struct page *, page, page)
146 ctf_integer(int, cold, cold)
147 )
148 )
149
150 LTTNG_TRACEPOINT_EVENT_MAP(mm_page_alloc, kmem_mm_page_alloc,
151
152 TP_PROTO(struct page *page, unsigned int order,
153 gfp_t gfp_flags, int migratetype),
154
155 TP_ARGS(page, order, gfp_flags, migratetype),
156
157 TP_FIELDS(
158 ctf_integer_hex(struct page *, page, page)
159 ctf_integer(unsigned int, order, order)
160 ctf_integer(gfp_t, gfp_flags, gfp_flags)
161 ctf_integer(int, migratetype, migratetype)
162 )
163 )
164
165 LTTNG_TRACEPOINT_EVENT_CLASS(kmem_mm_page,
166
167 TP_PROTO(struct page *page, unsigned int order, int migratetype),
168
169 TP_ARGS(page, order, migratetype),
170
171 TP_FIELDS(
172 ctf_integer_hex(struct page *, page, page)
173 ctf_integer(unsigned int, order, order)
174 ctf_integer(int, migratetype, migratetype)
175 )
176 )
177
178 LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(kmem_mm_page, mm_page_alloc_zone_locked,
179
180 kmem_mm_page_alloc_zone_locked,
181
182 TP_PROTO(struct page *page, unsigned int order, int migratetype),
183
184 TP_ARGS(page, order, migratetype)
185 )
186
187 LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(kmem_mm_page, mm_page_pcpu_drain,
188
189 kmem_mm_page_pcpu_drain,
190
191 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33))
192 TP_PROTO(struct page *page, unsigned int order, int migratetype),
193 #else
194 TP_PROTO(struct page *page, int order, int migratetype),
195 #endif
196
197 TP_ARGS(page, order, migratetype)
198 )
199
200 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,19,2) \
201 || LTTNG_KERNEL_RANGE(3,14,36, 3,15,0) \
202 || LTTNG_KERNEL_RANGE(3,16,35, 3,17,0) \
203 || LTTNG_KERNEL_RANGE(3,18,10, 3,19,0) \
204 || LTTNG_DEBIAN_KERNEL_RANGE(3,16,7,9,0,0, 3,17,0,0,0,0) \
205 || LTTNG_UBUNTU_KERNEL_RANGE(3,13,11,50, 3,14,0,0) \
206 || LTTNG_UBUNTU_KERNEL_RANGE(3,16,7,34, 3,17,0,0))
207
208 LTTNG_TRACEPOINT_EVENT_MAP(mm_page_alloc_extfrag,
209
210 kmem_mm_page_alloc_extfrag,
211
212 TP_PROTO(struct page *page,
213 int alloc_order, int fallback_order,
214 int alloc_migratetype, int fallback_migratetype),
215
216 TP_ARGS(page,
217 alloc_order, fallback_order,
218 alloc_migratetype, fallback_migratetype),
219
220 TP_FIELDS(
221 ctf_integer_hex(struct page *, page, page)
222 ctf_integer(int, alloc_order, alloc_order)
223 ctf_integer(int, fallback_order, fallback_order)
224 ctf_integer(int, alloc_migratetype, alloc_migratetype)
225 ctf_integer(int, fallback_migratetype, fallback_migratetype)
226 ctf_integer(int, change_ownership,
227 (alloc_migratetype == get_pageblock_migratetype(page)))
228 )
229 )
230
231 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,30))
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, int new_migratetype),
240
241 TP_ARGS(page,
242 alloc_order, fallback_order,
243 alloc_migratetype, fallback_migratetype, new_migratetype),
244
245 TP_FIELDS(
246 ctf_integer_hex(struct page *, page, page)
247 ctf_integer(int, alloc_order, alloc_order)
248 ctf_integer(int, fallback_order, fallback_order)
249 ctf_integer(int, alloc_migratetype, alloc_migratetype)
250 ctf_integer(int, fallback_migratetype, fallback_migratetype)
251 ctf_integer(int, change_ownership, (new_migratetype == alloc_migratetype))
252 )
253 )
254
255 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0))
256
257 LTTNG_TRACEPOINT_EVENT_MAP(mm_page_alloc_extfrag,
258
259 kmem_mm_page_alloc_extfrag,
260
261 TP_PROTO(struct page *page,
262 int alloc_order, int fallback_order,
263 int alloc_migratetype, int fallback_migratetype,
264 int change_ownership),
265
266 TP_ARGS(page,
267 alloc_order, fallback_order,
268 alloc_migratetype, fallback_migratetype,
269 change_ownership),
270
271 TP_FIELDS(
272 ctf_integer_hex(struct page *, page, page)
273 ctf_integer(int, alloc_order, alloc_order)
274 ctf_integer(int, fallback_order, fallback_order)
275 ctf_integer(int, alloc_migratetype, alloc_migratetype)
276 ctf_integer(int, fallback_migratetype, fallback_migratetype)
277 ctf_integer(int, change_ownership, change_ownership)
278 )
279 )
280
281 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0)) */
282
283 LTTNG_TRACEPOINT_EVENT_MAP(mm_page_alloc_extfrag,
284
285 kmem_mm_page_alloc_extfrag,
286
287 TP_PROTO(struct page *page,
288 int alloc_order, int fallback_order,
289 int alloc_migratetype, int fallback_migratetype),
290
291 TP_ARGS(page,
292 alloc_order, fallback_order,
293 alloc_migratetype, fallback_migratetype),
294
295 TP_FIELDS(
296 ctf_integer_hex(struct page *, page, page)
297 ctf_integer(int, alloc_order, alloc_order)
298 ctf_integer(int, fallback_order, fallback_order)
299 ctf_integer(int, alloc_migratetype, alloc_migratetype)
300 ctf_integer(int, fallback_migratetype, fallback_migratetype)
301 )
302 )
303
304 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0)) */
305
306 #endif
307
308 #endif /* LTTNG_TRACE_KMEM_H */
309
310 /* This part must be outside protection */
311 #include "../../../probes/define_trace.h"
This page took 0.035745 seconds and 4 git commands to generate.