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>
11 LTTNG_TRACEPOINT_EVENT_CLASS(kmem_alloc
,
13 TP_PROTO(unsigned long call_site
,
19 TP_ARGS(call_site
, ptr
, bytes_req
, bytes_alloc
, gfp_flags
),
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
)
30 LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(kmem_alloc
, kmalloc
,
34 TP_PROTO(unsigned long call_site
, const void *ptr
,
35 size_t bytes_req
, size_t bytes_alloc
, gfp_t gfp_flags
),
37 TP_ARGS(call_site
, ptr
, bytes_req
, bytes_alloc
, gfp_flags
)
40 LTTNG_TRACEPOINT_EVENT_INSTANCE(kmem_alloc
, kmem_cache_alloc
,
42 TP_PROTO(unsigned long call_site
, const void *ptr
,
43 size_t bytes_req
, size_t bytes_alloc
, gfp_t gfp_flags
),
45 TP_ARGS(call_site
, ptr
, bytes_req
, bytes_alloc
, gfp_flags
)
48 LTTNG_TRACEPOINT_EVENT_CLASS(kmem_alloc_node
,
50 TP_PROTO(unsigned long call_site
,
57 TP_ARGS(call_site
, ptr
, bytes_req
, bytes_alloc
, gfp_flags
, node
),
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
)
69 LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(kmem_alloc_node
, kmalloc_node
,
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
),
77 TP_ARGS(call_site
, ptr
, bytes_req
, bytes_alloc
, gfp_flags
, node
)
80 LTTNG_TRACEPOINT_EVENT_INSTANCE(kmem_alloc_node
, kmem_cache_alloc_node
,
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
),
86 TP_ARGS(call_site
, ptr
, bytes_req
, bytes_alloc
, gfp_flags
, node
)
89 LTTNG_TRACEPOINT_EVENT_CLASS(kmem_free
,
91 TP_PROTO(unsigned long call_site
, const void *ptr
),
93 TP_ARGS(call_site
, ptr
),
96 ctf_integer_hex(unsigned long, call_site
, call_site
)
97 ctf_integer_hex(const void *, ptr
, ptr
)
101 LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(kmem_free
, kfree
,
105 TP_PROTO(unsigned long call_site
, const void *ptr
),
107 TP_ARGS(call_site
, ptr
)
110 LTTNG_TRACEPOINT_EVENT_INSTANCE(kmem_free
, kmem_cache_free
,
112 TP_PROTO(unsigned long call_site
, const void *ptr
),
114 TP_ARGS(call_site
, ptr
)
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
,
121 LTTNG_TRACEPOINT_EVENT_MAP(mm_page_free_direct
, kmem_mm_page_free_direct
,
124 TP_PROTO(struct page
*page
, unsigned int order
),
126 TP_ARGS(page
, order
),
129 ctf_integer_hex(struct page
*, page
, page
)
130 ctf_integer(unsigned long, pfn
, page_to_pfn(page
))
131 ctf_integer(unsigned int, order
, order
)
135 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0))
136 LTTNG_TRACEPOINT_EVENT_MAP(mm_page_free_batched
, kmem_mm_page_free_batched
,
138 LTTNG_TRACEPOINT_EVENT_MAP(mm_pagevec_free
, kmem_pagevec_free
,
141 TP_PROTO(struct page
*page
, int cold
),
146 ctf_integer_hex(struct page
*, page
, page
)
147 ctf_integer(unsigned long, pfn
, page_to_pfn(page
))
148 ctf_integer(int, cold
, cold
)
152 LTTNG_TRACEPOINT_EVENT_MAP(mm_page_alloc
, kmem_mm_page_alloc
,
154 TP_PROTO(struct page
*page
, unsigned int order
,
155 gfp_t gfp_flags
, int migratetype
),
157 TP_ARGS(page
, order
, gfp_flags
, migratetype
),
160 ctf_integer_hex(struct page
*, page
, page
)
161 ctf_integer(unsigned long, pfn
,
162 page
? page_to_pfn(page
) : -1UL)
163 ctf_integer(unsigned int, order
, order
)
164 ctf_integer(gfp_t
, gfp_flags
, gfp_flags
)
165 ctf_integer(int, migratetype
, migratetype
)
169 LTTNG_TRACEPOINT_EVENT_CLASS(kmem_mm_page
,
171 TP_PROTO(struct page
*page
, unsigned int order
, int migratetype
),
173 TP_ARGS(page
, order
, migratetype
),
176 ctf_integer_hex(struct page
*, page
, page
)
177 ctf_integer(unsigned long, pfn
,
178 page
? page_to_pfn(page
) : -1UL)
179 ctf_integer(unsigned int, order
, order
)
180 ctf_integer(int, migratetype
, migratetype
)
184 LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(kmem_mm_page
, mm_page_alloc_zone_locked
,
186 kmem_mm_page_alloc_zone_locked
,
188 TP_PROTO(struct page
*page
, unsigned int order
, int migratetype
),
190 TP_ARGS(page
, order
, migratetype
)
193 LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(kmem_mm_page
, mm_page_pcpu_drain
,
195 kmem_mm_page_pcpu_drain
,
197 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33))
198 TP_PROTO(struct page
*page
, unsigned int order
, int migratetype
),
200 TP_PROTO(struct page
*page
, int order
, int migratetype
),
203 TP_ARGS(page
, order
, migratetype
)
206 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,19,2) \
207 || LTTNG_KERNEL_RANGE(3,14,36, 3,15,0) \
208 || LTTNG_KERNEL_RANGE(3,16,35, 3,17,0) \
209 || LTTNG_KERNEL_RANGE(3,18,10, 3,19,0) \
210 || LTTNG_DEBIAN_KERNEL_RANGE(3,16,7,9,0,0, 3,17,0,0,0,0) \
211 || LTTNG_UBUNTU_KERNEL_RANGE(3,13,11,50, 3,14,0,0) \
212 || LTTNG_UBUNTU_KERNEL_RANGE(3,16,7,34, 3,17,0,0))
214 LTTNG_TRACEPOINT_EVENT_MAP(mm_page_alloc_extfrag
,
216 kmem_mm_page_alloc_extfrag
,
218 TP_PROTO(struct page
*page
,
219 int alloc_order
, int fallback_order
,
220 int alloc_migratetype
, int fallback_migratetype
),
223 alloc_order
, fallback_order
,
224 alloc_migratetype
, fallback_migratetype
),
227 ctf_integer_hex(struct page
*, page
, page
)
228 ctf_integer(unsigned long, pfn
, page_to_pfn(page
))
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
,
234 (alloc_migratetype
== get_pageblock_migratetype(page
)))
238 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,30))
240 LTTNG_TRACEPOINT_EVENT_MAP(mm_page_alloc_extfrag
,
242 kmem_mm_page_alloc_extfrag
,
244 TP_PROTO(struct page
*page
,
245 int alloc_order
, int fallback_order
,
246 int alloc_migratetype
, int fallback_migratetype
, int new_migratetype
),
249 alloc_order
, fallback_order
,
250 alloc_migratetype
, fallback_migratetype
, new_migratetype
),
253 ctf_integer_hex(struct page
*, page
, page
)
254 ctf_integer(unsigned long, pfn
, page_to_pfn(page
))
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
))
263 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0))
265 LTTNG_TRACEPOINT_EVENT_MAP(mm_page_alloc_extfrag
,
267 kmem_mm_page_alloc_extfrag
,
269 TP_PROTO(struct page
*page
,
270 int alloc_order
, int fallback_order
,
271 int alloc_migratetype
, int fallback_migratetype
,
272 int change_ownership
),
275 alloc_order
, fallback_order
,
276 alloc_migratetype
, fallback_migratetype
,
280 ctf_integer_hex(struct page
*, page
, page
)
281 ctf_integer(unsigned long, pfn
, page_to_pfn(page
))
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
)
290 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0)) */
292 LTTNG_TRACEPOINT_EVENT_MAP(mm_page_alloc_extfrag
,
294 kmem_mm_page_alloc_extfrag
,
296 TP_PROTO(struct page
*page
,
297 int alloc_order
, int fallback_order
,
298 int alloc_migratetype
, int fallback_migratetype
),
301 alloc_order
, fallback_order
,
302 alloc_migratetype
, fallback_migratetype
),
305 ctf_integer_hex(struct page
*, page
, page
)
306 ctf_integer(unsigned long, pfn
, page_to_pfn(page
))
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
)
314 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0)) */
318 #endif /* LTTNG_TRACE_KMEM_H */
320 /* This part must be outside protection */
321 #include <probes/define_trace.h>