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