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 long, pfn
, page_to_pfn(page
))
134 ctf_integer(unsigned int, order
, order
)
138 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0))
139 LTTNG_TRACEPOINT_EVENT_MAP(mm_page_free_batched
, kmem_mm_page_free_batched
,
141 LTTNG_TRACEPOINT_EVENT_MAP(mm_pagevec_free
, kmem_pagevec_free
,
144 TP_PROTO(struct page
*page
, int cold
),
149 ctf_integer_hex(struct page
*, page
, page
)
150 ctf_integer(unsigned long, pfn
, page_to_pfn(page
))
151 ctf_integer(int, cold
, cold
)
155 LTTNG_TRACEPOINT_EVENT_MAP(mm_page_alloc
, kmem_mm_page_alloc
,
157 TP_PROTO(struct page
*page
, unsigned int order
,
158 gfp_t gfp_flags
, int migratetype
),
160 TP_ARGS(page
, order
, gfp_flags
, migratetype
),
163 ctf_integer_hex(struct page
*, page
, page
)
164 ctf_integer(unsigned long, pfn
,
165 page
? page_to_pfn(page
) : -1UL)
166 ctf_integer(unsigned int, order
, order
)
167 ctf_integer(gfp_t
, gfp_flags
, gfp_flags
)
168 ctf_integer(int, migratetype
, migratetype
)
172 LTTNG_TRACEPOINT_EVENT_CLASS(kmem_mm_page
,
174 TP_PROTO(struct page
*page
, unsigned int order
, int migratetype
),
176 TP_ARGS(page
, order
, migratetype
),
179 ctf_integer_hex(struct page
*, page
, page
)
180 ctf_integer(unsigned long, pfn
,
181 page
? page_to_pfn(page
) : -1UL)
182 ctf_integer(unsigned int, order
, order
)
183 ctf_integer(int, migratetype
, migratetype
)
187 LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(kmem_mm_page
, mm_page_alloc_zone_locked
,
189 kmem_mm_page_alloc_zone_locked
,
191 TP_PROTO(struct page
*page
, unsigned int order
, int migratetype
),
193 TP_ARGS(page
, order
, migratetype
)
196 LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(kmem_mm_page
, mm_page_pcpu_drain
,
198 kmem_mm_page_pcpu_drain
,
200 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33))
201 TP_PROTO(struct page
*page
, unsigned int order
, int migratetype
),
203 TP_PROTO(struct page
*page
, int order
, int migratetype
),
206 TP_ARGS(page
, order
, migratetype
)
209 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,19,2) \
210 || LTTNG_KERNEL_RANGE(3,14,36, 3,15,0) \
211 || LTTNG_KERNEL_RANGE(3,18,10, 3,19,0) \
212 || LTTNG_DEBIAN_KERNEL_RANGE(3,16,7,9,0,0, 3,17,0,0,0,0) \
213 || LTTNG_UBUNTU_KERNEL_RANGE(3,13,11,50, 3,14,0,0) \
214 || LTTNG_UBUNTU_KERNEL_RANGE(3,16,7,34, 3,17,0,0))
216 LTTNG_TRACEPOINT_EVENT_MAP(mm_page_alloc_extfrag
,
218 kmem_mm_page_alloc_extfrag
,
220 TP_PROTO(struct page
*page
,
221 int alloc_order
, int fallback_order
,
222 int alloc_migratetype
, int fallback_migratetype
),
225 alloc_order
, fallback_order
,
226 alloc_migratetype
, fallback_migratetype
),
229 ctf_integer_hex(struct page
*, page
, page
)
230 ctf_integer(unsigned long, pfn
, page_to_pfn(page
))
231 ctf_integer(int, alloc_order
, alloc_order
)
232 ctf_integer(int, fallback_order
, fallback_order
)
233 ctf_integer(int, alloc_migratetype
, alloc_migratetype
)
234 ctf_integer(int, fallback_migratetype
, fallback_migratetype
)
235 ctf_integer(int, change_ownership
,
236 (alloc_migratetype
== get_pageblock_migratetype(page
)))
240 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,30))
242 LTTNG_TRACEPOINT_EVENT_MAP(mm_page_alloc_extfrag
,
244 kmem_mm_page_alloc_extfrag
,
246 TP_PROTO(struct page
*page
,
247 int alloc_order
, int fallback_order
,
248 int alloc_migratetype
, int fallback_migratetype
, int new_migratetype
),
251 alloc_order
, fallback_order
,
252 alloc_migratetype
, fallback_migratetype
, new_migratetype
),
255 ctf_integer_hex(struct page
*, page
, page
)
256 ctf_integer(unsigned long, pfn
, page_to_pfn(page
))
257 ctf_integer(int, alloc_order
, alloc_order
)
258 ctf_integer(int, fallback_order
, fallback_order
)
259 ctf_integer(int, alloc_migratetype
, alloc_migratetype
)
260 ctf_integer(int, fallback_migratetype
, fallback_migratetype
)
261 ctf_integer(int, change_ownership
, (new_migratetype
== alloc_migratetype
))
265 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0))
267 LTTNG_TRACEPOINT_EVENT_MAP(mm_page_alloc_extfrag
,
269 kmem_mm_page_alloc_extfrag
,
271 TP_PROTO(struct page
*page
,
272 int alloc_order
, int fallback_order
,
273 int alloc_migratetype
, int fallback_migratetype
,
274 int change_ownership
),
277 alloc_order
, fallback_order
,
278 alloc_migratetype
, fallback_migratetype
,
282 ctf_integer_hex(struct page
*, page
, page
)
283 ctf_integer(unsigned long, pfn
, page_to_pfn(page
))
284 ctf_integer(int, alloc_order
, alloc_order
)
285 ctf_integer(int, fallback_order
, fallback_order
)
286 ctf_integer(int, alloc_migratetype
, alloc_migratetype
)
287 ctf_integer(int, fallback_migratetype
, fallback_migratetype
)
288 ctf_integer(int, change_ownership
, change_ownership
)
292 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0)) */
294 LTTNG_TRACEPOINT_EVENT_MAP(mm_page_alloc_extfrag
,
296 kmem_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 ctf_integer_hex(struct page
*, page
, page
)
308 ctf_integer(unsigned long, pfn
, page_to_pfn(page
))
309 ctf_integer(int, alloc_order
, alloc_order
)
310 ctf_integer(int, fallback_order
, fallback_order
)
311 ctf_integer(int, alloc_migratetype
, alloc_migratetype
)
312 ctf_integer(int, fallback_migratetype
, fallback_migratetype
)
316 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0)) */
320 #endif /* LTTNG_TRACE_KMEM_H */
322 /* This part must be outside protection */
323 #include <probes/define_trace.h>