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 ctf_integer_hex(unsigned long, call_site
, call_site
)
26 ctf_integer_hex(const void *, ptr
, ptr
)
27 ctf_integer(size_t, bytes_req
, bytes_req
)
28 ctf_integer(size_t, bytes_alloc
, bytes_alloc
)
29 ctf_integer(gfp_t
, gfp_flags
, gfp_flags
)
33 LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(kmem_alloc
, kmalloc
,
37 TP_PROTO(unsigned long call_site
, const void *ptr
,
38 size_t bytes_req
, size_t bytes_alloc
, gfp_t gfp_flags
),
40 TP_ARGS(call_site
, ptr
, bytes_req
, bytes_alloc
, gfp_flags
)
43 LTTNG_TRACEPOINT_EVENT_INSTANCE(kmem_alloc
, kmem_cache_alloc
,
45 TP_PROTO(unsigned long call_site
, const void *ptr
,
46 size_t bytes_req
, size_t bytes_alloc
, gfp_t gfp_flags
),
48 TP_ARGS(call_site
, ptr
, bytes_req
, bytes_alloc
, gfp_flags
)
51 LTTNG_TRACEPOINT_EVENT_CLASS(kmem_alloc_node
,
53 TP_PROTO(unsigned long call_site
,
60 TP_ARGS(call_site
, ptr
, bytes_req
, bytes_alloc
, gfp_flags
, node
),
63 ctf_integer_hex(unsigned long, call_site
, call_site
)
64 ctf_integer_hex(const void *, ptr
, ptr
)
65 ctf_integer(size_t, bytes_req
, bytes_req
)
66 ctf_integer(size_t, bytes_alloc
, bytes_alloc
)
67 ctf_integer(gfp_t
, gfp_flags
, gfp_flags
)
68 ctf_integer(int, node
, node
)
72 LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(kmem_alloc_node
, kmalloc_node
,
76 TP_PROTO(unsigned long call_site
, const void *ptr
,
77 size_t bytes_req
, size_t bytes_alloc
,
78 gfp_t gfp_flags
, int node
),
80 TP_ARGS(call_site
, ptr
, bytes_req
, bytes_alloc
, gfp_flags
, node
)
83 LTTNG_TRACEPOINT_EVENT_INSTANCE(kmem_alloc_node
, kmem_cache_alloc_node
,
85 TP_PROTO(unsigned long call_site
, const void *ptr
,
86 size_t bytes_req
, size_t bytes_alloc
,
87 gfp_t gfp_flags
, int node
),
89 TP_ARGS(call_site
, ptr
, bytes_req
, bytes_alloc
, gfp_flags
, node
)
92 LTTNG_TRACEPOINT_EVENT_CLASS(kmem_free
,
94 TP_PROTO(unsigned long call_site
, const void *ptr
),
96 TP_ARGS(call_site
, ptr
),
99 ctf_integer_hex(unsigned long, call_site
, call_site
)
100 ctf_integer_hex(const void *, ptr
, ptr
)
104 LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(kmem_free
, kfree
,
108 TP_PROTO(unsigned long call_site
, const void *ptr
),
110 TP_ARGS(call_site
, ptr
)
113 LTTNG_TRACEPOINT_EVENT_INSTANCE(kmem_free
, kmem_cache_free
,
115 TP_PROTO(unsigned long call_site
, const void *ptr
),
117 TP_ARGS(call_site
, ptr
)
120 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32))
121 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0))
122 LTTNG_TRACEPOINT_EVENT_MAP(mm_page_free
, kmem_mm_page_free
,
124 LTTNG_TRACEPOINT_EVENT_MAP(mm_page_free_direct
, kmem_mm_page_free_direct
,
127 TP_PROTO(struct page
*page
, unsigned int order
),
129 TP_ARGS(page
, order
),
132 ctf_integer_hex(struct page
*, page
, page
)
133 ctf_integer(unsigned int, order
, order
)
137 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0))
138 LTTNG_TRACEPOINT_EVENT_MAP(mm_page_free_batched
, kmem_mm_page_free_batched
,
140 LTTNG_TRACEPOINT_EVENT_MAP(mm_pagevec_free
, kmem_pagevec_free
,
143 TP_PROTO(struct page
*page
, int cold
),
148 ctf_integer_hex(struct page
*, page
, page
)
149 ctf_integer(int, cold
, cold
)
153 LTTNG_TRACEPOINT_EVENT_MAP(mm_page_alloc
, kmem_mm_page_alloc
,
155 TP_PROTO(struct page
*page
, unsigned int order
,
156 gfp_t gfp_flags
, int migratetype
),
158 TP_ARGS(page
, order
, gfp_flags
, migratetype
),
161 ctf_integer_hex(struct page
*, page
, page
)
162 ctf_integer(unsigned int, order
, order
)
163 ctf_integer(gfp_t
, gfp_flags
, gfp_flags
)
164 ctf_integer(int, migratetype
, migratetype
)
168 LTTNG_TRACEPOINT_EVENT_CLASS(kmem_mm_page
,
170 TP_PROTO(struct page
*page
, unsigned int order
, int migratetype
),
172 TP_ARGS(page
, order
, migratetype
),
175 ctf_integer_hex(struct page
*, page
, page
)
176 ctf_integer(unsigned int, order
, order
)
177 ctf_integer(int, migratetype
, migratetype
)
181 LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(kmem_mm_page
, mm_page_alloc_zone_locked
,
183 kmem_mm_page_alloc_zone_locked
,
185 TP_PROTO(struct page
*page
, unsigned int order
, int migratetype
),
187 TP_ARGS(page
, order
, migratetype
)
190 LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(kmem_mm_page
, mm_page_pcpu_drain
,
192 kmem_mm_page_pcpu_drain
,
194 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33))
195 TP_PROTO(struct page
*page
, unsigned int order
, int migratetype
),
197 TP_PROTO(struct page
*page
, int order
, int migratetype
),
200 TP_ARGS(page
, order
, migratetype
)
203 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,19,2) \
204 || LTTNG_KERNEL_RANGE(3,14,36, 3,15,0) \
205 || LTTNG_KERNEL_RANGE(3,18,10, 3,19,0) \
206 || LTTNG_DEBIAN_KERNEL_RANGE(3,16,7,9,0,0, 3,17,0,0,0,0) \
207 || LTTNG_UBUNTU_KERNEL_RANGE(3,13,11,50, 3,14,0,0) \
208 || LTTNG_UBUNTU_KERNEL_RANGE(3,16,7,38, 3,17,0,0))
210 LTTNG_TRACEPOINT_EVENT_MAP(mm_page_alloc_extfrag
,
212 kmem_mm_page_alloc_extfrag
,
214 TP_PROTO(struct page
*page
,
215 int alloc_order
, int fallback_order
,
216 int alloc_migratetype
, int fallback_migratetype
),
219 alloc_order
, fallback_order
,
220 alloc_migratetype
, fallback_migratetype
),
223 ctf_integer_hex(struct page
*, page
, page
)
224 ctf_integer(int, alloc_order
, alloc_order
)
225 ctf_integer(int, fallback_order
, fallback_order
)
226 ctf_integer(int, alloc_migratetype
, alloc_migratetype
)
227 ctf_integer(int, fallback_migratetype
, fallback_migratetype
)
228 ctf_integer(int, change_ownership
,
229 (alloc_migratetype
== get_pageblock_migratetype(page
)))
233 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,30))
235 LTTNG_TRACEPOINT_EVENT_MAP(mm_page_alloc_extfrag
,
237 kmem_mm_page_alloc_extfrag
,
239 TP_PROTO(struct page
*page
,
240 int alloc_order
, int fallback_order
,
241 int alloc_migratetype
, int fallback_migratetype
, int new_migratetype
),
244 alloc_order
, fallback_order
,
245 alloc_migratetype
, fallback_migratetype
, new_migratetype
),
248 ctf_integer_hex(struct page
*, page
, page
)
249 ctf_integer(int, alloc_order
, alloc_order
)
250 ctf_integer(int, fallback_order
, fallback_order
)
251 ctf_integer(int, alloc_migratetype
, alloc_migratetype
)
252 ctf_integer(int, fallback_migratetype
, fallback_migratetype
)
253 ctf_integer(int, change_ownership
, (new_migratetype
== alloc_migratetype
))
257 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0))
259 LTTNG_TRACEPOINT_EVENT_MAP(mm_page_alloc_extfrag
,
261 kmem_mm_page_alloc_extfrag
,
263 TP_PROTO(struct page
*page
,
264 int alloc_order
, int fallback_order
,
265 int alloc_migratetype
, int fallback_migratetype
,
266 int change_ownership
),
269 alloc_order
, fallback_order
,
270 alloc_migratetype
, fallback_migratetype
,
274 ctf_integer_hex(struct page
*, page
, page
)
275 ctf_integer(int, alloc_order
, alloc_order
)
276 ctf_integer(int, fallback_order
, fallback_order
)
277 ctf_integer(int, alloc_migratetype
, alloc_migratetype
)
278 ctf_integer(int, fallback_migratetype
, fallback_migratetype
)
279 ctf_integer(int, change_ownership
, change_ownership
)
283 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0)) */
285 LTTNG_TRACEPOINT_EVENT_MAP(mm_page_alloc_extfrag
,
287 kmem_mm_page_alloc_extfrag
,
289 TP_PROTO(struct page
*page
,
290 int alloc_order
, int fallback_order
,
291 int alloc_migratetype
, int fallback_migratetype
),
294 alloc_order
, fallback_order
,
295 alloc_migratetype
, fallback_migratetype
),
298 ctf_integer_hex(struct page
*, page
, page
)
299 ctf_integer(int, alloc_order
, alloc_order
)
300 ctf_integer(int, fallback_order
, fallback_order
)
301 ctf_integer(int, alloc_migratetype
, alloc_migratetype
)
302 ctf_integer(int, fallback_migratetype
, fallback_migratetype
)
306 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0)) */
310 #endif /* LTTNG_TRACE_KMEM_H */
312 /* This part must be outside protection */
313 #include "../../../probes/define_trace.h"