1 /* SPDX-License-Identifier: GPL-2.0 */
3 #define TRACE_SYSTEM kmem
5 #if !defined(LTTNG_TRACE_KMEM_H) || defined(TRACE_HEADER_MULTI_READ)
6 #define LTTNG_TRACE_KMEM_H
8 #include <probes/lttng-tracepoint-event.h>
9 #include <linux/types.h>
10 #include <linux/version.h>
12 LTTNG_TRACEPOINT_EVENT_CLASS(kmem_alloc
,
14 TP_PROTO(unsigned long call_site
,
20 TP_ARGS(call_site
, ptr
, bytes_req
, bytes_alloc
, gfp_flags
),
23 ctf_integer_hex(unsigned long, call_site
, call_site
)
24 ctf_integer_hex(const void *, ptr
, ptr
)
25 ctf_integer(size_t, bytes_req
, bytes_req
)
26 ctf_integer(size_t, bytes_alloc
, bytes_alloc
)
27 ctf_integer(gfp_t
, gfp_flags
, gfp_flags
)
31 LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(kmem_alloc
, kmalloc
,
35 TP_PROTO(unsigned long call_site
, const void *ptr
,
36 size_t bytes_req
, size_t bytes_alloc
, gfp_t gfp_flags
),
38 TP_ARGS(call_site
, ptr
, bytes_req
, bytes_alloc
, gfp_flags
)
41 LTTNG_TRACEPOINT_EVENT_INSTANCE(kmem_alloc
, kmem_cache_alloc
,
43 TP_PROTO(unsigned long call_site
, const void *ptr
,
44 size_t bytes_req
, size_t bytes_alloc
, gfp_t gfp_flags
),
46 TP_ARGS(call_site
, ptr
, bytes_req
, bytes_alloc
, gfp_flags
)
49 LTTNG_TRACEPOINT_EVENT_CLASS(kmem_alloc_node
,
51 TP_PROTO(unsigned long call_site
,
58 TP_ARGS(call_site
, ptr
, bytes_req
, bytes_alloc
, gfp_flags
, node
),
61 ctf_integer_hex(unsigned long, call_site
, call_site
)
62 ctf_integer_hex(const void *, ptr
, ptr
)
63 ctf_integer(size_t, bytes_req
, bytes_req
)
64 ctf_integer(size_t, bytes_alloc
, bytes_alloc
)
65 ctf_integer(gfp_t
, gfp_flags
, gfp_flags
)
66 ctf_integer(int, node
, node
)
70 LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(kmem_alloc_node
, kmalloc_node
,
74 TP_PROTO(unsigned long call_site
, const void *ptr
,
75 size_t bytes_req
, size_t bytes_alloc
,
76 gfp_t gfp_flags
, int node
),
78 TP_ARGS(call_site
, ptr
, bytes_req
, bytes_alloc
, gfp_flags
, node
)
81 LTTNG_TRACEPOINT_EVENT_INSTANCE(kmem_alloc_node
, kmem_cache_alloc_node
,
83 TP_PROTO(unsigned long call_site
, const void *ptr
,
84 size_t bytes_req
, size_t bytes_alloc
,
85 gfp_t gfp_flags
, int node
),
87 TP_ARGS(call_site
, ptr
, bytes_req
, bytes_alloc
, gfp_flags
, node
)
90 LTTNG_TRACEPOINT_EVENT_CLASS(kmem_free
,
92 TP_PROTO(unsigned long call_site
, const void *ptr
),
94 TP_ARGS(call_site
, ptr
),
97 ctf_integer_hex(unsigned long, call_site
, call_site
)
98 ctf_integer_hex(const void *, ptr
, ptr
)
102 LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(kmem_free
, kfree
,
106 TP_PROTO(unsigned long call_site
, const void *ptr
),
108 TP_ARGS(call_site
, ptr
)
111 LTTNG_TRACEPOINT_EVENT_INSTANCE(kmem_free
, kmem_cache_free
,
113 TP_PROTO(unsigned long call_site
, const void *ptr
),
115 TP_ARGS(call_site
, ptr
)
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(4,15,0))
136 LTTNG_TRACEPOINT_EVENT_MAP(mm_page_free_batched
, kmem_mm_page_free_batched
,
138 TP_PROTO(struct page
*page
),
143 ctf_integer_hex(struct page
*, page
, page
)
144 ctf_integer(unsigned long, pfn
, page_to_pfn(page
))
147 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0))
148 LTTNG_TRACEPOINT_EVENT_MAP(mm_page_free_batched
, kmem_mm_page_free_batched
,
150 TP_PROTO(struct page
*page
, int cold
),
155 ctf_integer_hex(struct page
*, page
, page
)
156 ctf_integer(unsigned long, pfn
, page_to_pfn(page
))
157 ctf_integer(int, cold
, cold
)
161 LTTNG_TRACEPOINT_EVENT_MAP(mm_pagevec_free
, kmem_pagevec_free
,
163 TP_PROTO(struct page
*page
, int cold
),
168 ctf_integer_hex(struct page
*, page
, page
)
169 ctf_integer(unsigned long, pfn
, page_to_pfn(page
))
170 ctf_integer(int, cold
, cold
)
175 LTTNG_TRACEPOINT_EVENT_MAP(mm_page_alloc
, kmem_mm_page_alloc
,
177 TP_PROTO(struct page
*page
, unsigned int order
,
178 gfp_t gfp_flags
, int migratetype
),
180 TP_ARGS(page
, order
, gfp_flags
, migratetype
),
183 ctf_integer_hex(struct page
*, page
, page
)
184 ctf_integer(unsigned long, pfn
,
185 page
? page_to_pfn(page
) : -1UL)
186 ctf_integer(unsigned int, order
, order
)
187 ctf_integer(gfp_t
, gfp_flags
, gfp_flags
)
188 ctf_integer(int, migratetype
, migratetype
)
192 LTTNG_TRACEPOINT_EVENT_CLASS(kmem_mm_page
,
194 TP_PROTO(struct page
*page
, unsigned int order
, int migratetype
),
196 TP_ARGS(page
, order
, migratetype
),
199 ctf_integer_hex(struct page
*, page
, page
)
200 ctf_integer(unsigned long, pfn
,
201 page
? page_to_pfn(page
) : -1UL)
202 ctf_integer(unsigned int, order
, order
)
203 ctf_integer(int, migratetype
, migratetype
)
207 LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(kmem_mm_page
, mm_page_alloc_zone_locked
,
209 kmem_mm_page_alloc_zone_locked
,
211 TP_PROTO(struct page
*page
, unsigned int order
, int migratetype
),
213 TP_ARGS(page
, order
, migratetype
)
216 LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(kmem_mm_page
, mm_page_pcpu_drain
,
218 kmem_mm_page_pcpu_drain
,
220 TP_PROTO(struct page
*page
, unsigned int order
, int migratetype
),
222 TP_ARGS(page
, order
, migratetype
)
225 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,19,2) \
226 || LTTNG_KERNEL_RANGE(3,14,36, 3,15,0) \
227 || LTTNG_KERNEL_RANGE(3,16,35, 3,17,0) \
228 || LTTNG_KERNEL_RANGE(3,18,10, 3,19,0) \
229 || LTTNG_DEBIAN_KERNEL_RANGE(3,16,7,9,0,0, 3,17,0,0,0,0) \
230 || LTTNG_UBUNTU_KERNEL_RANGE(3,13,11,50, 3,14,0,0) \
231 || LTTNG_UBUNTU_KERNEL_RANGE(3,16,7,34, 3,17,0,0))
233 LTTNG_TRACEPOINT_EVENT_MAP(mm_page_alloc_extfrag
,
235 kmem_mm_page_alloc_extfrag
,
237 TP_PROTO(struct page
*page
,
238 int alloc_order
, int fallback_order
,
239 int alloc_migratetype
, int fallback_migratetype
),
242 alloc_order
, fallback_order
,
243 alloc_migratetype
, fallback_migratetype
),
246 ctf_integer_hex(struct page
*, page
, page
)
247 ctf_integer(unsigned long, pfn
, page_to_pfn(page
))
248 ctf_integer(int, alloc_order
, alloc_order
)
249 ctf_integer(int, fallback_order
, fallback_order
)
250 ctf_integer(int, alloc_migratetype
, alloc_migratetype
)
251 ctf_integer(int, fallback_migratetype
, fallback_migratetype
)
252 ctf_integer(int, change_ownership
,
253 (alloc_migratetype
== get_pageblock_migratetype(page
)))
257 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,30))
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
, int new_migratetype
),
268 alloc_order
, fallback_order
,
269 alloc_migratetype
, fallback_migratetype
, new_migratetype
),
272 ctf_integer_hex(struct page
*, page
, page
)
273 ctf_integer(unsigned long, pfn
, page_to_pfn(page
))
274 ctf_integer(int, alloc_order
, alloc_order
)
275 ctf_integer(int, fallback_order
, fallback_order
)
276 ctf_integer(int, alloc_migratetype
, alloc_migratetype
)
277 ctf_integer(int, fallback_migratetype
, fallback_migratetype
)
278 ctf_integer(int, change_ownership
, (new_migratetype
== alloc_migratetype
))
282 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0))
284 LTTNG_TRACEPOINT_EVENT_MAP(mm_page_alloc_extfrag
,
286 kmem_mm_page_alloc_extfrag
,
288 TP_PROTO(struct page
*page
,
289 int alloc_order
, int fallback_order
,
290 int alloc_migratetype
, int fallback_migratetype
,
291 int change_ownership
),
294 alloc_order
, fallback_order
,
295 alloc_migratetype
, fallback_migratetype
,
299 ctf_integer_hex(struct page
*, page
, page
)
300 ctf_integer(unsigned long, pfn
, page_to_pfn(page
))
301 ctf_integer(int, alloc_order
, alloc_order
)
302 ctf_integer(int, fallback_order
, fallback_order
)
303 ctf_integer(int, alloc_migratetype
, alloc_migratetype
)
304 ctf_integer(int, fallback_migratetype
, fallback_migratetype
)
305 ctf_integer(int, change_ownership
, change_ownership
)
309 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0)) */
311 LTTNG_TRACEPOINT_EVENT_MAP(mm_page_alloc_extfrag
,
313 kmem_mm_page_alloc_extfrag
,
315 TP_PROTO(struct page
*page
,
316 int alloc_order
, int fallback_order
,
317 int alloc_migratetype
, int fallback_migratetype
),
320 alloc_order
, fallback_order
,
321 alloc_migratetype
, fallback_migratetype
),
324 ctf_integer_hex(struct page
*, page
, page
)
325 ctf_integer(unsigned long, pfn
, page_to_pfn(page
))
326 ctf_integer(int, alloc_order
, alloc_order
)
327 ctf_integer(int, fallback_order
, fallback_order
)
328 ctf_integer(int, alloc_migratetype
, alloc_migratetype
)
329 ctf_integer(int, fallback_migratetype
, fallback_migratetype
)
333 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0)) */
335 #endif /* LTTNG_TRACE_KMEM_H */
337 /* This part must be outside protection */
338 #include <probes/define_trace.h>