Merge branch 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
[cris-mirror.git] / include / trace / events / kmem.h
blobeb57e3037deb0d912975ea6eba5223f47917ca07
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #undef TRACE_SYSTEM
3 #define TRACE_SYSTEM kmem
5 #if !defined(_TRACE_KMEM_H) || defined(TRACE_HEADER_MULTI_READ)
6 #define _TRACE_KMEM_H
8 #include <linux/types.h>
9 #include <linux/tracepoint.h>
10 #include <trace/events/mmflags.h>
12 DECLARE_EVENT_CLASS(kmem_alloc,
14 TP_PROTO(unsigned long call_site,
15 const void *ptr,
16 size_t bytes_req,
17 size_t bytes_alloc,
18 gfp_t gfp_flags),
20 TP_ARGS(call_site, ptr, bytes_req, bytes_alloc, gfp_flags),
22 TP_STRUCT__entry(
23 __field( unsigned long, call_site )
24 __field( const void *, ptr )
25 __field( size_t, bytes_req )
26 __field( size_t, bytes_alloc )
27 __field( gfp_t, gfp_flags )
30 TP_fast_assign(
31 __entry->call_site = call_site;
32 __entry->ptr = ptr;
33 __entry->bytes_req = bytes_req;
34 __entry->bytes_alloc = bytes_alloc;
35 __entry->gfp_flags = gfp_flags;
38 TP_printk("call_site=%lx ptr=%p bytes_req=%zu bytes_alloc=%zu gfp_flags=%s",
39 __entry->call_site,
40 __entry->ptr,
41 __entry->bytes_req,
42 __entry->bytes_alloc,
43 show_gfp_flags(__entry->gfp_flags))
46 DEFINE_EVENT(kmem_alloc, kmalloc,
48 TP_PROTO(unsigned long call_site, const void *ptr,
49 size_t bytes_req, size_t bytes_alloc, gfp_t gfp_flags),
51 TP_ARGS(call_site, ptr, bytes_req, bytes_alloc, gfp_flags)
54 DEFINE_EVENT(kmem_alloc, kmem_cache_alloc,
56 TP_PROTO(unsigned long call_site, const void *ptr,
57 size_t bytes_req, size_t bytes_alloc, gfp_t gfp_flags),
59 TP_ARGS(call_site, ptr, bytes_req, bytes_alloc, gfp_flags)
62 DECLARE_EVENT_CLASS(kmem_alloc_node,
64 TP_PROTO(unsigned long call_site,
65 const void *ptr,
66 size_t bytes_req,
67 size_t bytes_alloc,
68 gfp_t gfp_flags,
69 int node),
71 TP_ARGS(call_site, ptr, bytes_req, bytes_alloc, gfp_flags, node),
73 TP_STRUCT__entry(
74 __field( unsigned long, call_site )
75 __field( const void *, ptr )
76 __field( size_t, bytes_req )
77 __field( size_t, bytes_alloc )
78 __field( gfp_t, gfp_flags )
79 __field( int, node )
82 TP_fast_assign(
83 __entry->call_site = call_site;
84 __entry->ptr = ptr;
85 __entry->bytes_req = bytes_req;
86 __entry->bytes_alloc = bytes_alloc;
87 __entry->gfp_flags = gfp_flags;
88 __entry->node = node;
91 TP_printk("call_site=%lx ptr=%p bytes_req=%zu bytes_alloc=%zu gfp_flags=%s node=%d",
92 __entry->call_site,
93 __entry->ptr,
94 __entry->bytes_req,
95 __entry->bytes_alloc,
96 show_gfp_flags(__entry->gfp_flags),
97 __entry->node)
100 DEFINE_EVENT(kmem_alloc_node, kmalloc_node,
102 TP_PROTO(unsigned long call_site, const void *ptr,
103 size_t bytes_req, size_t bytes_alloc,
104 gfp_t gfp_flags, int node),
106 TP_ARGS(call_site, ptr, bytes_req, bytes_alloc, gfp_flags, node)
109 DEFINE_EVENT(kmem_alloc_node, kmem_cache_alloc_node,
111 TP_PROTO(unsigned long call_site, const void *ptr,
112 size_t bytes_req, size_t bytes_alloc,
113 gfp_t gfp_flags, int node),
115 TP_ARGS(call_site, ptr, bytes_req, bytes_alloc, gfp_flags, node)
118 DECLARE_EVENT_CLASS(kmem_free,
120 TP_PROTO(unsigned long call_site, const void *ptr),
122 TP_ARGS(call_site, ptr),
124 TP_STRUCT__entry(
125 __field( unsigned long, call_site )
126 __field( const void *, ptr )
129 TP_fast_assign(
130 __entry->call_site = call_site;
131 __entry->ptr = ptr;
134 TP_printk("call_site=%lx ptr=%p", __entry->call_site, __entry->ptr)
137 DEFINE_EVENT(kmem_free, kfree,
139 TP_PROTO(unsigned long call_site, const void *ptr),
141 TP_ARGS(call_site, ptr)
144 DEFINE_EVENT(kmem_free, kmem_cache_free,
146 TP_PROTO(unsigned long call_site, const void *ptr),
148 TP_ARGS(call_site, ptr)
151 TRACE_EVENT(mm_page_free,
153 TP_PROTO(struct page *page, unsigned int order),
155 TP_ARGS(page, order),
157 TP_STRUCT__entry(
158 __field( unsigned long, pfn )
159 __field( unsigned int, order )
162 TP_fast_assign(
163 __entry->pfn = page_to_pfn(page);
164 __entry->order = order;
167 TP_printk("page=%p pfn=%lu order=%d",
168 pfn_to_page(__entry->pfn),
169 __entry->pfn,
170 __entry->order)
173 TRACE_EVENT(mm_page_free_batched,
175 TP_PROTO(struct page *page),
177 TP_ARGS(page),
179 TP_STRUCT__entry(
180 __field( unsigned long, pfn )
183 TP_fast_assign(
184 __entry->pfn = page_to_pfn(page);
187 TP_printk("page=%p pfn=%lu order=0",
188 pfn_to_page(__entry->pfn),
189 __entry->pfn)
192 TRACE_EVENT(mm_page_alloc,
194 TP_PROTO(struct page *page, unsigned int order,
195 gfp_t gfp_flags, int migratetype),
197 TP_ARGS(page, order, gfp_flags, migratetype),
199 TP_STRUCT__entry(
200 __field( unsigned long, pfn )
201 __field( unsigned int, order )
202 __field( gfp_t, gfp_flags )
203 __field( int, migratetype )
206 TP_fast_assign(
207 __entry->pfn = page ? page_to_pfn(page) : -1UL;
208 __entry->order = order;
209 __entry->gfp_flags = gfp_flags;
210 __entry->migratetype = migratetype;
213 TP_printk("page=%p pfn=%lu order=%d migratetype=%d gfp_flags=%s",
214 __entry->pfn != -1UL ? pfn_to_page(__entry->pfn) : NULL,
215 __entry->pfn != -1UL ? __entry->pfn : 0,
216 __entry->order,
217 __entry->migratetype,
218 show_gfp_flags(__entry->gfp_flags))
221 DECLARE_EVENT_CLASS(mm_page,
223 TP_PROTO(struct page *page, unsigned int order, int migratetype),
225 TP_ARGS(page, order, migratetype),
227 TP_STRUCT__entry(
228 __field( unsigned long, pfn )
229 __field( unsigned int, order )
230 __field( int, migratetype )
233 TP_fast_assign(
234 __entry->pfn = page ? page_to_pfn(page) : -1UL;
235 __entry->order = order;
236 __entry->migratetype = migratetype;
239 TP_printk("page=%p pfn=%lu order=%u migratetype=%d percpu_refill=%d",
240 __entry->pfn != -1UL ? pfn_to_page(__entry->pfn) : NULL,
241 __entry->pfn != -1UL ? __entry->pfn : 0,
242 __entry->order,
243 __entry->migratetype,
244 __entry->order == 0)
247 DEFINE_EVENT(mm_page, mm_page_alloc_zone_locked,
249 TP_PROTO(struct page *page, unsigned int order, int migratetype),
251 TP_ARGS(page, order, migratetype)
254 TRACE_EVENT(mm_page_pcpu_drain,
256 TP_PROTO(struct page *page, unsigned int order, int migratetype),
258 TP_ARGS(page, order, migratetype),
260 TP_STRUCT__entry(
261 __field( unsigned long, pfn )
262 __field( unsigned int, order )
263 __field( int, migratetype )
266 TP_fast_assign(
267 __entry->pfn = page ? page_to_pfn(page) : -1UL;
268 __entry->order = order;
269 __entry->migratetype = migratetype;
272 TP_printk("page=%p pfn=%lu order=%d migratetype=%d",
273 pfn_to_page(__entry->pfn), __entry->pfn,
274 __entry->order, __entry->migratetype)
277 TRACE_EVENT(mm_page_alloc_extfrag,
279 TP_PROTO(struct page *page,
280 int alloc_order, int fallback_order,
281 int alloc_migratetype, int fallback_migratetype),
283 TP_ARGS(page,
284 alloc_order, fallback_order,
285 alloc_migratetype, fallback_migratetype),
287 TP_STRUCT__entry(
288 __field( unsigned long, pfn )
289 __field( int, alloc_order )
290 __field( int, fallback_order )
291 __field( int, alloc_migratetype )
292 __field( int, fallback_migratetype )
293 __field( int, change_ownership )
296 TP_fast_assign(
297 __entry->pfn = page_to_pfn(page);
298 __entry->alloc_order = alloc_order;
299 __entry->fallback_order = fallback_order;
300 __entry->alloc_migratetype = alloc_migratetype;
301 __entry->fallback_migratetype = fallback_migratetype;
302 __entry->change_ownership = (alloc_migratetype ==
303 get_pageblock_migratetype(page));
306 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",
307 pfn_to_page(__entry->pfn),
308 __entry->pfn,
309 __entry->alloc_order,
310 __entry->fallback_order,
311 pageblock_order,
312 __entry->alloc_migratetype,
313 __entry->fallback_migratetype,
314 __entry->fallback_order < pageblock_order,
315 __entry->change_ownership)
318 #endif /* _TRACE_KMEM_H */
320 /* This part must be outside protection */
321 #include <trace/define_trace.h>