Namespace all tracepoints
[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 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
11 #include <trace/events/gfpflags.h>
12 #endif
13
14 LTTNG_TRACEPOINT_EVENT_CLASS(kmem_alloc,
15
16 TP_PROTO(unsigned long call_site,
17 const void *ptr,
18 size_t bytes_req,
19 size_t bytes_alloc,
20 gfp_t gfp_flags),
21
22 TP_ARGS(call_site, ptr, bytes_req, bytes_alloc, gfp_flags),
23
24 TP_STRUCT__entry(
25 __field_hex( unsigned long, call_site )
26 __field_hex( const void *, ptr )
27 __field( size_t, bytes_req )
28 __field( size_t, bytes_alloc )
29 __field( gfp_t, gfp_flags )
30 ),
31
32 TP_fast_assign(
33 tp_assign(call_site, call_site)
34 tp_assign(ptr, ptr)
35 tp_assign(bytes_req, bytes_req)
36 tp_assign(bytes_alloc, bytes_alloc)
37 tp_assign(gfp_flags, gfp_flags)
38 ),
39
40 TP_printk("call_site=%lx ptr=%p bytes_req=%zu bytes_alloc=%zu gfp_flags=%s",
41 __entry->call_site,
42 __entry->ptr,
43 __entry->bytes_req,
44 __entry->bytes_alloc,
45 show_gfp_flags(__entry->gfp_flags))
46 )
47
48 LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(kmem_alloc, kmalloc,
49
50 kmem_kmalloc,
51
52 TP_PROTO(unsigned long call_site, const void *ptr,
53 size_t bytes_req, size_t bytes_alloc, gfp_t gfp_flags),
54
55 TP_ARGS(call_site, ptr, bytes_req, bytes_alloc, gfp_flags)
56 )
57
58 LTTNG_TRACEPOINT_EVENT_INSTANCE(kmem_alloc, kmem_cache_alloc,
59
60 TP_PROTO(unsigned long call_site, const void *ptr,
61 size_t bytes_req, size_t bytes_alloc, gfp_t gfp_flags),
62
63 TP_ARGS(call_site, ptr, bytes_req, bytes_alloc, gfp_flags)
64 )
65
66 LTTNG_TRACEPOINT_EVENT_CLASS(kmem_alloc_node,
67
68 TP_PROTO(unsigned long call_site,
69 const void *ptr,
70 size_t bytes_req,
71 size_t bytes_alloc,
72 gfp_t gfp_flags,
73 int node),
74
75 TP_ARGS(call_site, ptr, bytes_req, bytes_alloc, gfp_flags, node),
76
77 TP_STRUCT__entry(
78 __field_hex( unsigned long, call_site )
79 __field_hex( const void *, ptr )
80 __field( size_t, bytes_req )
81 __field( size_t, bytes_alloc )
82 __field( gfp_t, gfp_flags )
83 __field( int, node )
84 ),
85
86 TP_fast_assign(
87 tp_assign(call_site, call_site)
88 tp_assign(ptr, ptr)
89 tp_assign(bytes_req, bytes_req)
90 tp_assign(bytes_alloc, bytes_alloc)
91 tp_assign(gfp_flags, gfp_flags)
92 tp_assign(node, node)
93 ),
94
95 TP_printk("call_site=%lx ptr=%p bytes_req=%zu bytes_alloc=%zu gfp_flags=%s node=%d",
96 __entry->call_site,
97 __entry->ptr,
98 __entry->bytes_req,
99 __entry->bytes_alloc,
100 show_gfp_flags(__entry->gfp_flags),
101 __entry->node)
102 )
103
104 LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(kmem_alloc_node, kmalloc_node,
105
106 kmem_kmalloc_node,
107
108 TP_PROTO(unsigned long call_site, const void *ptr,
109 size_t bytes_req, size_t bytes_alloc,
110 gfp_t gfp_flags, int node),
111
112 TP_ARGS(call_site, ptr, bytes_req, bytes_alloc, gfp_flags, node)
113 )
114
115 LTTNG_TRACEPOINT_EVENT_INSTANCE(kmem_alloc_node, kmem_cache_alloc_node,
116
117 TP_PROTO(unsigned long call_site, const void *ptr,
118 size_t bytes_req, size_t bytes_alloc,
119 gfp_t gfp_flags, int node),
120
121 TP_ARGS(call_site, ptr, bytes_req, bytes_alloc, gfp_flags, node)
122 )
123
124 LTTNG_TRACEPOINT_EVENT_CLASS(kmem_free,
125
126 TP_PROTO(unsigned long call_site, const void *ptr),
127
128 TP_ARGS(call_site, ptr),
129
130 TP_STRUCT__entry(
131 __field_hex( unsigned long, call_site )
132 __field_hex( const void *, ptr )
133 ),
134
135 TP_fast_assign(
136 tp_assign(call_site, call_site)
137 tp_assign(ptr, ptr)
138 ),
139
140 TP_printk("call_site=%lx ptr=%p", __entry->call_site, __entry->ptr)
141 )
142
143 LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(kmem_free, kfree,
144
145 kmem_kfree,
146
147 TP_PROTO(unsigned long call_site, const void *ptr),
148
149 TP_ARGS(call_site, ptr)
150 )
151
152 LTTNG_TRACEPOINT_EVENT_INSTANCE(kmem_free, kmem_cache_free,
153
154 TP_PROTO(unsigned long call_site, const void *ptr),
155
156 TP_ARGS(call_site, ptr)
157 )
158
159 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32))
160 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0))
161 LTTNG_TRACEPOINT_EVENT_MAP(mm_page_free, kmem_mm_page_free,
162 #else
163 LTTNG_TRACEPOINT_EVENT_MAP(mm_page_free_direct, kmem_mm_page_free_direct,
164 #endif
165
166 TP_PROTO(struct page *page, unsigned int order),
167
168 TP_ARGS(page, order),
169
170 TP_STRUCT__entry(
171 __field_hex( struct page *, page )
172 __field( unsigned int, order )
173 ),
174
175 TP_fast_assign(
176 tp_assign(page, page)
177 tp_assign(order, order)
178 ),
179
180 TP_printk("page=%p pfn=%lu order=%d",
181 __entry->page,
182 page_to_pfn(__entry->page),
183 __entry->order)
184 )
185
186 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0))
187 LTTNG_TRACEPOINT_EVENT_MAP(mm_page_free_batched, kmem_mm_page_free_batched,
188 #else
189 LTTNG_TRACEPOINT_EVENT_MAP(mm_pagevec_free, kmem_pagevec_free,
190 #endif
191
192 TP_PROTO(struct page *page, int cold),
193
194 TP_ARGS(page, cold),
195
196 TP_STRUCT__entry(
197 __field_hex( struct page *, page )
198 __field( int, cold )
199 ),
200
201 TP_fast_assign(
202 tp_assign(page, page)
203 tp_assign(cold, cold)
204 ),
205
206 TP_printk("page=%p pfn=%lu order=0 cold=%d",
207 __entry->page,
208 page_to_pfn(__entry->page),
209 __entry->cold)
210 )
211
212 LTTNG_TRACEPOINT_EVENT_MAP(mm_page_alloc, kmem_mm_page_alloc,
213
214 TP_PROTO(struct page *page, unsigned int order,
215 gfp_t gfp_flags, int migratetype),
216
217 TP_ARGS(page, order, gfp_flags, migratetype),
218
219 TP_STRUCT__entry(
220 __field_hex( struct page *, page )
221 __field( unsigned int, order )
222 __field( gfp_t, gfp_flags )
223 __field( int, migratetype )
224 ),
225
226 TP_fast_assign(
227 tp_assign(page, page)
228 tp_assign(order, order)
229 tp_assign(gfp_flags, gfp_flags)
230 tp_assign(migratetype, migratetype)
231 ),
232
233 TP_printk("page=%p pfn=%lu order=%d migratetype=%d gfp_flags=%s",
234 __entry->page,
235 __entry->page ? page_to_pfn(__entry->page) : 0,
236 __entry->order,
237 __entry->migratetype,
238 show_gfp_flags(__entry->gfp_flags))
239 )
240
241 LTTNG_TRACEPOINT_EVENT_CLASS(kmem_mm_page,
242
243 TP_PROTO(struct page *page, unsigned int order, int migratetype),
244
245 TP_ARGS(page, order, migratetype),
246
247 TP_STRUCT__entry(
248 __field_hex( struct page *, page )
249 __field( unsigned int, order )
250 __field( int, migratetype )
251 ),
252
253 TP_fast_assign(
254 tp_assign(page, page)
255 tp_assign(order, order)
256 tp_assign(migratetype, migratetype)
257 ),
258
259 TP_printk("page=%p pfn=%lu order=%u migratetype=%d percpu_refill=%d",
260 __entry->page,
261 __entry->page ? page_to_pfn(__entry->page) : 0,
262 __entry->order,
263 __entry->migratetype,
264 __entry->order == 0)
265 )
266
267 LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(kmem_mm_page, mm_page_alloc_zone_locked,
268
269 kmem_mm_page_alloc_zone_locked,
270
271 TP_PROTO(struct page *page, unsigned int order, int migratetype),
272
273 TP_ARGS(page, order, migratetype)
274 )
275
276 LTTNG_TRACEPOINT_EVENT_INSTANCE_PRINT_MAP(kmem_mm_page, mm_page_pcpu_drain,
277
278 kmem_mm_page_pcpu_drain,
279
280 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33))
281 TP_PROTO(struct page *page, unsigned int order, int migratetype),
282 #else
283 TP_PROTO(struct page *page, int order, int migratetype),
284 #endif
285
286 TP_ARGS(page, order, migratetype),
287
288 TP_printk("page=%p pfn=%lu order=%d migratetype=%d",
289 __entry->page, page_to_pfn(__entry->page),
290 __entry->order, __entry->migratetype)
291 )
292
293 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,19,2) \
294 || LTTNG_KERNEL_RANGE(3,14,36, 3,15,0))
295
296 LTTNG_TRACEPOINT_EVENT(mm_page_alloc_extfrag,
297
298 TP_PROTO(struct page *page,
299 int alloc_order, int fallback_order,
300 int alloc_migratetype, int fallback_migratetype),
301
302 TP_ARGS(page,
303 alloc_order, fallback_order,
304 alloc_migratetype, fallback_migratetype),
305
306 TP_STRUCT__entry(
307 __field_hex( struct page *, page )
308 __field( int, alloc_order )
309 __field( int, fallback_order )
310 __field( int, alloc_migratetype )
311 __field( int, fallback_migratetype )
312 __field( int, change_ownership )
313 ),
314
315 TP_fast_assign(
316 tp_assign(page, page)
317 tp_assign(alloc_order, alloc_order)
318 tp_assign(fallback_order, fallback_order)
319 tp_assign(alloc_migratetype, alloc_migratetype)
320 tp_assign(fallback_migratetype, fallback_migratetype)
321 tp_assign(change_ownership,
322 (alloc_migratetype == get_pageblock_migratetype(page)))
323 ),
324
325 TP_printk("page=%p pfn=%lu alloc_order=%d fallback_order=%d pageblock_order=%d alloc_migratetype=%d fallback_migratetype=%d fragmenting=%d change_ownership=%d",
326 __entry->page,
327 page_to_pfn(__entry->page),
328 __entry->alloc_order,
329 __entry->fallback_order,
330 pageblock_order,
331 __entry->alloc_migratetype,
332 __entry->fallback_migratetype,
333 __entry->fallback_order < pageblock_order,
334 __entry->change_ownership)
335 )
336
337 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,30))
338
339 LTTNG_TRACEPOINT_EVENT(mm_page_alloc_extfrag,
340
341 TP_PROTO(struct page *page,
342 int alloc_order, int fallback_order,
343 int alloc_migratetype, int fallback_migratetype, int new_migratetype),
344
345 TP_ARGS(page,
346 alloc_order, fallback_order,
347 alloc_migratetype, fallback_migratetype, new_migratetype),
348
349 TP_STRUCT__entry(
350 __field_hex( struct page *, page )
351 __field( int, alloc_order )
352 __field( int, fallback_order )
353 __field( int, alloc_migratetype )
354 __field( int, fallback_migratetype )
355 __field( int, change_ownership )
356 ),
357
358 TP_fast_assign(
359 tp_assign(page, page)
360 tp_assign(alloc_order, alloc_order)
361 tp_assign(fallback_order, fallback_order)
362 tp_assign(alloc_migratetype, alloc_migratetype)
363 tp_assign(fallback_migratetype, fallback_migratetype)
364 tp_assign(change_ownership, (new_migratetype == alloc_migratetype))
365 ),
366
367 TP_printk("page=%p pfn=%lu alloc_order=%d fallback_order=%d pageblock_order=%d alloc_migratetype=%d fallback_migratetype=%d fragmenting=%d change_ownership=%d",
368 __entry->page,
369 page_to_pfn(__entry->page),
370 __entry->alloc_order,
371 __entry->fallback_order,
372 pageblock_order,
373 __entry->alloc_migratetype,
374 __entry->fallback_migratetype,
375 __entry->fallback_order < pageblock_order,
376 __entry->change_ownership)
377 )
378
379 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0))
380
381 LTTNG_TRACEPOINT_EVENT_MAP(mm_page_alloc_extfrag,
382
383 kmem_mm_page_alloc_extfrag,
384
385 TP_PROTO(struct page *page,
386 int alloc_order, int fallback_order,
387 int alloc_migratetype, int fallback_migratetype,
388 int change_ownership),
389
390 TP_ARGS(page,
391 alloc_order, fallback_order,
392 alloc_migratetype, fallback_migratetype,
393 change_ownership),
394
395 TP_STRUCT__entry(
396 __field_hex( struct page *, page )
397 __field( int, alloc_order )
398 __field( int, fallback_order )
399 __field( int, alloc_migratetype )
400 __field( int, fallback_migratetype )
401 __field( int, change_ownership )
402 ),
403
404 TP_fast_assign(
405 tp_assign(page, page)
406 tp_assign(alloc_order, alloc_order)
407 tp_assign(fallback_order, fallback_order)
408 tp_assign(alloc_migratetype, alloc_migratetype)
409 tp_assign(fallback_migratetype, fallback_migratetype)
410 tp_assign(change_ownership, change_ownership)
411 ),
412
413 TP_printk("page=%p pfn=%lu alloc_order=%d fallback_order=%d pageblock_order=%d alloc_migratetype=%d fallback_migratetype=%d fragmenting=%d change_ownership=%d",
414 __entry->page,
415 page_to_pfn(__entry->page),
416 __entry->alloc_order,
417 __entry->fallback_order,
418 pageblock_order,
419 __entry->alloc_migratetype,
420 __entry->fallback_migratetype,
421 __entry->fallback_order < pageblock_order,
422 __entry->change_ownership)
423 )
424
425 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0)) */
426
427 LTTNG_TRACEPOINT_EVENT_MAP(mm_page_alloc_extfrag,
428
429 kmem_mm_page_alloc_extfrag,
430
431 TP_PROTO(struct page *page,
432 int alloc_order, int fallback_order,
433 int alloc_migratetype, int fallback_migratetype),
434
435 TP_ARGS(page,
436 alloc_order, fallback_order,
437 alloc_migratetype, fallback_migratetype),
438
439 TP_STRUCT__entry(
440 __field_hex( struct page *, page )
441 __field( int, alloc_order )
442 __field( int, fallback_order )
443 __field( int, alloc_migratetype )
444 __field( int, fallback_migratetype )
445 ),
446
447 TP_fast_assign(
448 tp_assign(page, page)
449 tp_assign(alloc_order, alloc_order)
450 tp_assign(fallback_order, fallback_order)
451 tp_assign(alloc_migratetype, alloc_migratetype)
452 tp_assign(fallback_migratetype, fallback_migratetype)
453 ),
454
455 TP_printk("page=%p pfn=%lu alloc_order=%d fallback_order=%d pageblock_order=%d alloc_migratetype=%d fallback_migratetype=%d fragmenting=%d change_ownership=%d",
456 __entry->page,
457 page_to_pfn(__entry->page),
458 __entry->alloc_order,
459 __entry->fallback_order,
460 pageblock_order,
461 __entry->alloc_migratetype,
462 __entry->fallback_migratetype,
463 __entry->fallback_order < pageblock_order,
464 __entry->alloc_migratetype == __entry->fallback_migratetype)
465 )
466
467 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0)) */
468
469 #endif
470
471 #endif /* LTTNG_TRACE_KMEM_H */
472
473 /* This part must be outside protection */
474 #include "../../../probes/define_trace.h"
This page took 0.045074 seconds and 4 git commands to generate.