Commit | Line | Data |
---|---|---|
b283666f PW |
1 | #undef TRACE_SYSTEM |
2 | #define TRACE_SYSTEM kmem | |
3 | ||
3bc29f0a MD |
4 | #if !defined(LTTNG_TRACE_KMEM_H) || defined(TRACE_HEADER_MULTI_READ) |
5 | #define LTTNG_TRACE_KMEM_H | |
b283666f | 6 | |
3bc29f0a | 7 | #include "../../../probes/lttng-tracepoint-event.h" |
7c68b363 | 8 | #include <linux/types.h> |
7c68b363 AG |
9 | #include <linux/version.h> |
10 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36)) | |
11 | #include <trace/events/gfpflags.h> | |
12 | #endif | |
13 | ||
3bc29f0a | 14 | LTTNG_TRACEPOINT_EVENT_CLASS(kmem_alloc, |
b283666f PW |
15 | |
16 | TP_PROTO(unsigned long call_site, | |
17 | const void *ptr, | |
18 | size_t bytes_req, | |
19 | size_t bytes_alloc, | |
20 | gfp_t gfp_flags), | |
21 | ||
22 | TP_ARGS(call_site, ptr, bytes_req, bytes_alloc, gfp_flags), | |
23 | ||
f127e61e MD |
24 | TP_FIELDS( |
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) | |
30 | ) | |
b283666f PW |
31 | ) |
32 | ||
3bc29f0a | 33 | LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(kmem_alloc, kmalloc, |
9cf29d3e MD |
34 | |
35 | kmem_kmalloc, | |
b283666f PW |
36 | |
37 | TP_PROTO(unsigned long call_site, const void *ptr, | |
38 | size_t bytes_req, size_t bytes_alloc, gfp_t gfp_flags), | |
39 | ||
40 | TP_ARGS(call_site, ptr, bytes_req, bytes_alloc, gfp_flags) | |
41 | ) | |
42 | ||
3bc29f0a | 43 | LTTNG_TRACEPOINT_EVENT_INSTANCE(kmem_alloc, kmem_cache_alloc, |
b283666f PW |
44 | |
45 | TP_PROTO(unsigned long call_site, const void *ptr, | |
46 | size_t bytes_req, size_t bytes_alloc, gfp_t gfp_flags), | |
47 | ||
48 | TP_ARGS(call_site, ptr, bytes_req, bytes_alloc, gfp_flags) | |
49 | ) | |
50 | ||
3bc29f0a | 51 | LTTNG_TRACEPOINT_EVENT_CLASS(kmem_alloc_node, |
b283666f PW |
52 | |
53 | TP_PROTO(unsigned long call_site, | |
54 | const void *ptr, | |
55 | size_t bytes_req, | |
56 | size_t bytes_alloc, | |
57 | gfp_t gfp_flags, | |
58 | int node), | |
59 | ||
60 | TP_ARGS(call_site, ptr, bytes_req, bytes_alloc, gfp_flags, node), | |
61 | ||
f127e61e MD |
62 | TP_FIELDS( |
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) | |
69 | ) | |
b283666f PW |
70 | ) |
71 | ||
3bc29f0a | 72 | LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(kmem_alloc_node, kmalloc_node, |
9cf29d3e MD |
73 | |
74 | kmem_kmalloc_node, | |
b283666f PW |
75 | |
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), | |
79 | ||
80 | TP_ARGS(call_site, ptr, bytes_req, bytes_alloc, gfp_flags, node) | |
81 | ) | |
82 | ||
3bc29f0a | 83 | LTTNG_TRACEPOINT_EVENT_INSTANCE(kmem_alloc_node, kmem_cache_alloc_node, |
b283666f PW |
84 | |
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), | |
88 | ||
89 | TP_ARGS(call_site, ptr, bytes_req, bytes_alloc, gfp_flags, node) | |
90 | ) | |
91 | ||
3bc29f0a | 92 | LTTNG_TRACEPOINT_EVENT_CLASS(kmem_free, |
b283666f PW |
93 | |
94 | TP_PROTO(unsigned long call_site, const void *ptr), | |
95 | ||
96 | TP_ARGS(call_site, ptr), | |
97 | ||
f127e61e MD |
98 | TP_FIELDS( |
99 | ctf_integer_hex(unsigned long, call_site, call_site) | |
100 | ctf_integer_hex(const void *, ptr, ptr) | |
101 | ) | |
b283666f PW |
102 | ) |
103 | ||
3bc29f0a | 104 | LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(kmem_free, kfree, |
9cf29d3e MD |
105 | |
106 | kmem_kfree, | |
b283666f PW |
107 | |
108 | TP_PROTO(unsigned long call_site, const void *ptr), | |
109 | ||
110 | TP_ARGS(call_site, ptr) | |
111 | ) | |
112 | ||
3bc29f0a | 113 | LTTNG_TRACEPOINT_EVENT_INSTANCE(kmem_free, kmem_cache_free, |
b283666f PW |
114 | |
115 | TP_PROTO(unsigned long call_site, const void *ptr), | |
116 | ||
117 | TP_ARGS(call_site, ptr) | |
118 | ) | |
119 | ||
7c68b363 AG |
120 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32)) |
121 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0)) | |
9bbf98da | 122 | LTTNG_TRACEPOINT_EVENT_MAP(mm_page_free, kmem_mm_page_free, |
7c68b363 | 123 | #else |
9bbf98da | 124 | LTTNG_TRACEPOINT_EVENT_MAP(mm_page_free_direct, kmem_mm_page_free_direct, |
7c68b363 | 125 | #endif |
b283666f PW |
126 | |
127 | TP_PROTO(struct page *page, unsigned int order), | |
128 | ||
129 | TP_ARGS(page, order), | |
130 | ||
f127e61e MD |
131 | TP_FIELDS( |
132 | ctf_integer_hex(struct page *, page, page) | |
133 | ctf_integer(unsigned int, order, order) | |
134 | ) | |
b283666f PW |
135 | ) |
136 | ||
7c68b363 | 137 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0)) |
9bbf98da | 138 | LTTNG_TRACEPOINT_EVENT_MAP(mm_page_free_batched, kmem_mm_page_free_batched, |
7c68b363 | 139 | #else |
9bbf98da | 140 | LTTNG_TRACEPOINT_EVENT_MAP(mm_pagevec_free, kmem_pagevec_free, |
7c68b363 | 141 | #endif |
b283666f PW |
142 | |
143 | TP_PROTO(struct page *page, int cold), | |
144 | ||
145 | TP_ARGS(page, cold), | |
146 | ||
f127e61e MD |
147 | TP_FIELDS( |
148 | ctf_integer_hex(struct page *, page, page) | |
149 | ctf_integer(int, cold, cold) | |
150 | ) | |
b283666f PW |
151 | ) |
152 | ||
9bbf98da | 153 | LTTNG_TRACEPOINT_EVENT_MAP(mm_page_alloc, kmem_mm_page_alloc, |
b283666f PW |
154 | |
155 | TP_PROTO(struct page *page, unsigned int order, | |
156 | gfp_t gfp_flags, int migratetype), | |
157 | ||
158 | TP_ARGS(page, order, gfp_flags, migratetype), | |
159 | ||
f127e61e MD |
160 | TP_FIELDS( |
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) | |
165 | ) | |
b283666f PW |
166 | ) |
167 | ||
9bbf98da | 168 | LTTNG_TRACEPOINT_EVENT_CLASS(kmem_mm_page, |
b283666f PW |
169 | |
170 | TP_PROTO(struct page *page, unsigned int order, int migratetype), | |
171 | ||
172 | TP_ARGS(page, order, migratetype), | |
173 | ||
f127e61e MD |
174 | TP_FIELDS( |
175 | ctf_integer_hex(struct page *, page, page) | |
176 | ctf_integer(unsigned int, order, order) | |
177 | ctf_integer(int, migratetype, migratetype) | |
178 | ) | |
b283666f PW |
179 | ) |
180 | ||
9bbf98da MD |
181 | LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(kmem_mm_page, mm_page_alloc_zone_locked, |
182 | ||
183 | kmem_mm_page_alloc_zone_locked, | |
b283666f PW |
184 | |
185 | TP_PROTO(struct page *page, unsigned int order, int migratetype), | |
186 | ||
187 | TP_ARGS(page, order, migratetype) | |
188 | ) | |
189 | ||
f127e61e | 190 | LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(kmem_mm_page, mm_page_pcpu_drain, |
9bbf98da MD |
191 | |
192 | kmem_mm_page_pcpu_drain, | |
b283666f | 193 | |
7c68b363 | 194 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33)) |
b283666f | 195 | TP_PROTO(struct page *page, unsigned int order, int migratetype), |
7c68b363 AG |
196 | #else |
197 | TP_PROTO(struct page *page, int order, int migratetype), | |
198 | #endif | |
b283666f | 199 | |
f127e61e | 200 | TP_ARGS(page, order, migratetype) |
b283666f PW |
201 | ) |
202 | ||
cd955ba2 | 203 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,19,2) \ |
72e6c528 MD |
204 | || LTTNG_KERNEL_RANGE(3,14,36, 3,15,0) \ |
205 | || LTTNG_DEBIAN_KERNEL_RANGE(3,16,7,9,0,0, 3,17,0,0,0,0)) | |
2cf0c2ca | 206 | |
7c9c39d2 MD |
207 | LTTNG_TRACEPOINT_EVENT_MAP(mm_page_alloc_extfrag, |
208 | ||
209 | kmem_mm_page_alloc_extfrag, | |
2cf0c2ca MD |
210 | |
211 | TP_PROTO(struct page *page, | |
212 | int alloc_order, int fallback_order, | |
213 | int alloc_migratetype, int fallback_migratetype), | |
214 | ||
215 | TP_ARGS(page, | |
216 | alloc_order, fallback_order, | |
217 | alloc_migratetype, fallback_migratetype), | |
218 | ||
c94b360d MD |
219 | TP_FIELDS( |
220 | ctf_integer_hex(struct page *, page, page) | |
221 | ctf_integer(int, alloc_order, alloc_order) | |
222 | ctf_integer(int, fallback_order, fallback_order) | |
223 | ctf_integer(int, alloc_migratetype, alloc_migratetype) | |
224 | ctf_integer(int, fallback_migratetype, fallback_migratetype) | |
225 | ctf_integer(int, change_ownership, | |
2cf0c2ca | 226 | (alloc_migratetype == get_pageblock_migratetype(page))) |
c94b360d | 227 | ) |
2cf0c2ca MD |
228 | ) |
229 | ||
230 | #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,30)) | |
8b831331 | 231 | |
7c9c39d2 MD |
232 | LTTNG_TRACEPOINT_EVENT_MAP(mm_page_alloc_extfrag, |
233 | ||
234 | kmem_mm_page_alloc_extfrag, | |
8b831331 MD |
235 | |
236 | TP_PROTO(struct page *page, | |
237 | int alloc_order, int fallback_order, | |
238 | int alloc_migratetype, int fallback_migratetype, int new_migratetype), | |
239 | ||
240 | TP_ARGS(page, | |
241 | alloc_order, fallback_order, | |
242 | alloc_migratetype, fallback_migratetype, new_migratetype), | |
243 | ||
c94b360d MD |
244 | TP_FIELDS( |
245 | ctf_integer_hex(struct page *, page, page) | |
246 | ctf_integer(int, alloc_order, alloc_order) | |
247 | ctf_integer(int, fallback_order, fallback_order) | |
248 | ctf_integer(int, alloc_migratetype, alloc_migratetype) | |
249 | ctf_integer(int, fallback_migratetype, fallback_migratetype) | |
250 | ctf_integer(int, change_ownership, (new_migratetype == alloc_migratetype)) | |
251 | ) | |
8b831331 MD |
252 | ) |
253 | ||
254 | #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0)) | |
926b9256 | 255 | |
9bbf98da MD |
256 | LTTNG_TRACEPOINT_EVENT_MAP(mm_page_alloc_extfrag, |
257 | ||
258 | kmem_mm_page_alloc_extfrag, | |
926b9256 MD |
259 | |
260 | TP_PROTO(struct page *page, | |
261 | int alloc_order, int fallback_order, | |
262 | int alloc_migratetype, int fallback_migratetype, | |
263 | int change_ownership), | |
264 | ||
265 | TP_ARGS(page, | |
266 | alloc_order, fallback_order, | |
267 | alloc_migratetype, fallback_migratetype, | |
268 | change_ownership), | |
269 | ||
f127e61e MD |
270 | TP_FIELDS( |
271 | ctf_integer_hex(struct page *, page, page) | |
272 | ctf_integer(int, alloc_order, alloc_order) | |
273 | ctf_integer(int, fallback_order, fallback_order) | |
274 | ctf_integer(int, alloc_migratetype, alloc_migratetype) | |
275 | ctf_integer(int, fallback_migratetype, fallback_migratetype) | |
276 | ctf_integer(int, change_ownership, change_ownership) | |
277 | ) | |
926b9256 MD |
278 | ) |
279 | ||
280 | #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0)) */ | |
281 | ||
9bbf98da MD |
282 | LTTNG_TRACEPOINT_EVENT_MAP(mm_page_alloc_extfrag, |
283 | ||
284 | kmem_mm_page_alloc_extfrag, | |
b283666f PW |
285 | |
286 | TP_PROTO(struct page *page, | |
287 | int alloc_order, int fallback_order, | |
288 | int alloc_migratetype, int fallback_migratetype), | |
289 | ||
290 | TP_ARGS(page, | |
291 | alloc_order, fallback_order, | |
292 | alloc_migratetype, fallback_migratetype), | |
293 | ||
f127e61e MD |
294 | TP_FIELDS( |
295 | ctf_integer_hex(struct page *, page, page) | |
296 | ctf_integer(int, alloc_order, alloc_order) | |
297 | ctf_integer(int, fallback_order, fallback_order) | |
298 | ctf_integer(int, alloc_migratetype, alloc_migratetype) | |
299 | ctf_integer(int, fallback_migratetype, fallback_migratetype) | |
300 | ) | |
b283666f | 301 | ) |
926b9256 MD |
302 | |
303 | #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0)) */ | |
304 | ||
7c68b363 | 305 | #endif |
b283666f | 306 | |
3bc29f0a | 307 | #endif /* LTTNG_TRACE_KMEM_H */ |
b283666f PW |
308 | |
309 | /* This part must be outside protection */ | |
310 | #include "../../../probes/define_trace.h" |