2 #define TRACE_SYSTEM kmem
4 #if !defined(LTTNG_TRACE_KMEM_H) || defined(TRACE_HEADER_MULTI_READ)
5 #define LTTNG_TRACE_KMEM_H
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>
14 LTTNG_TRACEPOINT_EVENT_CLASS(kmem_alloc
,
16 TP_PROTO(unsigned long call_site
,
22 TP_ARGS(call_site
, ptr
, bytes_req
, bytes_alloc
, gfp_flags
),
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
)
33 tp_assign(call_site
, call_site
)
35 tp_assign(bytes_req
, bytes_req
)
36 tp_assign(bytes_alloc
, bytes_alloc
)
37 tp_assign(gfp_flags
, gfp_flags
)
40 TP_printk("call_site=%lx ptr=%p bytes_req=%zu bytes_alloc=%zu gfp_flags=%s",
45 show_gfp_flags(__entry
->gfp_flags
))
48 LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(kmem_alloc
, kmalloc
,
52 TP_PROTO(unsigned long call_site
, const void *ptr
,
53 size_t bytes_req
, size_t bytes_alloc
, gfp_t gfp_flags
),
55 TP_ARGS(call_site
, ptr
, bytes_req
, bytes_alloc
, gfp_flags
)
58 LTTNG_TRACEPOINT_EVENT_INSTANCE(kmem_alloc
, kmem_cache_alloc
,
60 TP_PROTO(unsigned long call_site
, const void *ptr
,
61 size_t bytes_req
, size_t bytes_alloc
, gfp_t gfp_flags
),
63 TP_ARGS(call_site
, ptr
, bytes_req
, bytes_alloc
, gfp_flags
)
66 LTTNG_TRACEPOINT_EVENT_CLASS(kmem_alloc_node
,
68 TP_PROTO(unsigned long call_site
,
75 TP_ARGS(call_site
, ptr
, bytes_req
, bytes_alloc
, gfp_flags
, node
),
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
)
87 tp_assign(call_site
, call_site
)
89 tp_assign(bytes_req
, bytes_req
)
90 tp_assign(bytes_alloc
, bytes_alloc
)
91 tp_assign(gfp_flags
, gfp_flags
)
95 TP_printk("call_site=%lx ptr=%p bytes_req=%zu bytes_alloc=%zu gfp_flags=%s node=%d",
100 show_gfp_flags(__entry
->gfp_flags
),
104 LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(kmem_alloc_node
, kmalloc_node
,
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
),
112 TP_ARGS(call_site
, ptr
, bytes_req
, bytes_alloc
, gfp_flags
, node
)
115 LTTNG_TRACEPOINT_EVENT_INSTANCE(kmem_alloc_node
, kmem_cache_alloc_node
,
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
),
121 TP_ARGS(call_site
, ptr
, bytes_req
, bytes_alloc
, gfp_flags
, node
)
124 LTTNG_TRACEPOINT_EVENT_CLASS(kmem_free
,
126 TP_PROTO(unsigned long call_site
, const void *ptr
),
128 TP_ARGS(call_site
, ptr
),
131 __field_hex( unsigned long, call_site
)
132 __field_hex( const void *, ptr
)
136 tp_assign(call_site
, call_site
)
140 TP_printk("call_site=%lx ptr=%p", __entry
->call_site
, __entry
->ptr
)
143 LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(kmem_free
, kfree
,
147 TP_PROTO(unsigned long call_site
, const void *ptr
),
149 TP_ARGS(call_site
, ptr
)
152 LTTNG_TRACEPOINT_EVENT_INSTANCE(kmem_free
, kmem_cache_free
,
154 TP_PROTO(unsigned long call_site
, const void *ptr
),
156 TP_ARGS(call_site
, ptr
)
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
,
163 LTTNG_TRACEPOINT_EVENT_MAP(mm_page_free_direct
, kmem_mm_page_free_direct
,
166 TP_PROTO(struct page
*page
, unsigned int order
),
168 TP_ARGS(page
, order
),
171 __field_hex( struct page
*, page
)
172 __field( unsigned int, order
)
176 tp_assign(page
, page
)
177 tp_assign(order
, order
)
180 TP_printk("page=%p pfn=%lu order=%d",
182 page_to_pfn(__entry
->page
),
186 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0))
187 LTTNG_TRACEPOINT_EVENT_MAP(mm_page_free_batched
, kmem_mm_page_free_batched
,
189 LTTNG_TRACEPOINT_EVENT_MAP(mm_pagevec_free
, kmem_pagevec_free
,
192 TP_PROTO(struct page
*page
, int cold
),
197 __field_hex( struct page
*, page
)
202 tp_assign(page
, page
)
203 tp_assign(cold
, cold
)
206 TP_printk("page=%p pfn=%lu order=0 cold=%d",
208 page_to_pfn(__entry
->page
),
212 LTTNG_TRACEPOINT_EVENT_MAP(mm_page_alloc
, kmem_mm_page_alloc
,
214 TP_PROTO(struct page
*page
, unsigned int order
,
215 gfp_t gfp_flags
, int migratetype
),
217 TP_ARGS(page
, order
, gfp_flags
, migratetype
),
220 __field_hex( struct page
*, page
)
221 __field( unsigned int, order
)
222 __field( gfp_t
, gfp_flags
)
223 __field( int, migratetype
)
227 tp_assign(page
, page
)
228 tp_assign(order
, order
)
229 tp_assign(gfp_flags
, gfp_flags
)
230 tp_assign(migratetype
, migratetype
)
233 TP_printk("page=%p pfn=%lu order=%d migratetype=%d gfp_flags=%s",
235 __entry
->page
? page_to_pfn(__entry
->page
) : 0,
237 __entry
->migratetype
,
238 show_gfp_flags(__entry
->gfp_flags
))
241 LTTNG_TRACEPOINT_EVENT_CLASS(kmem_mm_page
,
243 TP_PROTO(struct page
*page
, unsigned int order
, int migratetype
),
245 TP_ARGS(page
, order
, migratetype
),
248 __field_hex( struct page
*, page
)
249 __field( unsigned int, order
)
250 __field( int, migratetype
)
254 tp_assign(page
, page
)
255 tp_assign(order
, order
)
256 tp_assign(migratetype
, migratetype
)
259 TP_printk("page=%p pfn=%lu order=%u migratetype=%d percpu_refill=%d",
261 __entry
->page
? page_to_pfn(__entry
->page
) : 0,
263 __entry
->migratetype
,
267 LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(kmem_mm_page
, mm_page_alloc_zone_locked
,
269 kmem_mm_page_alloc_zone_locked
,
271 TP_PROTO(struct page
*page
, unsigned int order
, int migratetype
),
273 TP_ARGS(page
, order
, migratetype
)
276 LTTNG_TRACEPOINT_EVENT_INSTANCE_PRINT_MAP(kmem_mm_page
, mm_page_pcpu_drain
,
278 kmem_mm_page_pcpu_drain
,
280 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33))
281 TP_PROTO(struct page
*page
, unsigned int order
, int migratetype
),
283 TP_PROTO(struct page
*page
, int order
, int migratetype
),
286 TP_ARGS(page
, order
, migratetype
),
288 TP_printk("page=%p pfn=%lu order=%d migratetype=%d",
289 __entry
->page
, page_to_pfn(__entry
->page
),
290 __entry
->order
, __entry
->migratetype
)
293 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,19,2) \
294 || LTTNG_KERNEL_RANGE(3,14,36, 3,15,0))
296 LTTNG_TRACEPOINT_EVENT(mm_page_alloc_extfrag
,
298 TP_PROTO(struct page
*page
,
299 int alloc_order
, int fallback_order
,
300 int alloc_migratetype
, int fallback_migratetype
),
303 alloc_order
, fallback_order
,
304 alloc_migratetype
, fallback_migratetype
),
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
)
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
)))
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",
327 page_to_pfn(__entry
->page
),
328 __entry
->alloc_order
,
329 __entry
->fallback_order
,
331 __entry
->alloc_migratetype
,
332 __entry
->fallback_migratetype
,
333 __entry
->fallback_order
< pageblock_order
,
334 __entry
->change_ownership
)
337 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,30))
339 LTTNG_TRACEPOINT_EVENT(mm_page_alloc_extfrag
,
341 TP_PROTO(struct page
*page
,
342 int alloc_order
, int fallback_order
,
343 int alloc_migratetype
, int fallback_migratetype
, int new_migratetype
),
346 alloc_order
, fallback_order
,
347 alloc_migratetype
, fallback_migratetype
, new_migratetype
),
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
)
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
))
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",
369 page_to_pfn(__entry
->page
),
370 __entry
->alloc_order
,
371 __entry
->fallback_order
,
373 __entry
->alloc_migratetype
,
374 __entry
->fallback_migratetype
,
375 __entry
->fallback_order
< pageblock_order
,
376 __entry
->change_ownership
)
379 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0))
381 LTTNG_TRACEPOINT_EVENT_MAP(mm_page_alloc_extfrag
,
383 kmem_mm_page_alloc_extfrag
,
385 TP_PROTO(struct page
*page
,
386 int alloc_order
, int fallback_order
,
387 int alloc_migratetype
, int fallback_migratetype
,
388 int change_ownership
),
391 alloc_order
, fallback_order
,
392 alloc_migratetype
, fallback_migratetype
,
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
)
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
)
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",
415 page_to_pfn(__entry
->page
),
416 __entry
->alloc_order
,
417 __entry
->fallback_order
,
419 __entry
->alloc_migratetype
,
420 __entry
->fallback_migratetype
,
421 __entry
->fallback_order
< pageblock_order
,
422 __entry
->change_ownership
)
425 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0)) */
427 LTTNG_TRACEPOINT_EVENT_MAP(mm_page_alloc_extfrag
,
429 kmem_mm_page_alloc_extfrag
,
431 TP_PROTO(struct page
*page
,
432 int alloc_order
, int fallback_order
,
433 int alloc_migratetype
, int fallback_migratetype
),
436 alloc_order
, fallback_order
,
437 alloc_migratetype
, fallback_migratetype
),
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
)
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
)
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",
457 page_to_pfn(__entry
->page
),
458 __entry
->alloc_order
,
459 __entry
->fallback_order
,
461 __entry
->alloc_migratetype
,
462 __entry
->fallback_migratetype
,
463 __entry
->fallback_order
< pageblock_order
,
464 __entry
->alloc_migratetype
== __entry
->fallback_migratetype
)
467 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0)) */
471 #endif /* LTTNG_TRACE_KMEM_H */
473 /* This part must be outside protection */
474 #include "../../../probes/define_trace.h"