fd898c511f51cb6660cb0e80c9c447d3868c9726
[lttng-modules.git] / include / instrumentation / events / lttng-module / writeback.h
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 #undef TRACE_SYSTEM
3 #define TRACE_SYSTEM writeback
4
5 #if !defined(LTTNG_TRACE_WRITEBACK_H) || defined(TRACE_HEADER_MULTI_READ)
6 #define LTTNG_TRACE_WRITEBACK_H
7
8 #include <lttng/tracepoint-event.h>
9 #include <linux/tracepoint.h>
10 #include <linux/backing-dev.h>
11 #include <linux/writeback.h>
12 #include <linux/version.h>
13
14 #ifndef _TRACE_WRITEBACK_DEF_
15 #define _TRACE_WRITEBACK_DEF_
16
17 /*
18 * Vanilla kernels before 4.0 do not implement inode_to_bdi
19 * RHEL kernels before 3.10.0-327.10.1 do not implement inode_to_bdi
20 * RHEL kernel 3.10.0-327.10.1 has inode_to_bdi
21 * RHEL kernel 3.10.0-327.13.1 includes a partial merge of upstream
22 * commit a212b105b07d75b48b1a166378282e8a77fbf53d which inlines
23 * inode_to_bdi but not sb_is_blkdev_sb making it unusable by modules.
24 */
25 #if (LINUX_VERSION_CODE < KERNEL_VERSION(4,0,0))
26 static inline struct backing_dev_info *lttng_inode_to_bdi(struct inode *inode)
27 {
28 struct super_block *sb;
29
30 if (!inode)
31 return &noop_backing_dev_info;
32
33 sb = inode->i_sb;
34
35 if (strcmp(sb->s_type->name, "bdev") == 0)
36 return inode->i_mapping->backing_dev_info;
37
38 return sb->s_bdi;
39 }
40 #else
41 static inline struct backing_dev_info *lttng_inode_to_bdi(struct inode *inode)
42 {
43 return inode_to_bdi(inode);
44 }
45 #endif /* #if (LINUX_VERSION_CODE < KERNEL_VERSION(4,0,0)) */
46
47 #endif
48
49 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,0,0))
50 #define show_inode_state(state) \
51 __print_flags(state, "|", \
52 {I_DIRTY_SYNC, "I_DIRTY_SYNC"}, \
53 {I_DIRTY_DATASYNC, "I_DIRTY_DATASYNC"}, \
54 {I_DIRTY_PAGES, "I_DIRTY_PAGES"}, \
55 {I_NEW, "I_NEW"}, \
56 {I_WILL_FREE, "I_WILL_FREE"}, \
57 {I_FREEING, "I_FREEING"}, \
58 {I_CLEAR, "I_CLEAR"}, \
59 {I_SYNC, "I_SYNC"}, \
60 {I_DIRTY_TIME, "I_DIRTY_TIME"}, \
61 {I_DIRTY_TIME_EXPIRED, "I_DIRTY_TIME_EXPIRED"}, \
62 {I_REFERENCED, "I_REFERENCED"} \
63 )
64 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,0,0)) */
65 #define show_inode_state(state) \
66 __print_flags(state, "|", \
67 {I_DIRTY_SYNC, "I_DIRTY_SYNC"}, \
68 {I_DIRTY_DATASYNC, "I_DIRTY_DATASYNC"}, \
69 {I_DIRTY_PAGES, "I_DIRTY_PAGES"}, \
70 {I_NEW, "I_NEW"}, \
71 {I_WILL_FREE, "I_WILL_FREE"}, \
72 {I_FREEING, "I_FREEING"}, \
73 {I_CLEAR, "I_CLEAR"}, \
74 {I_SYNC, "I_SYNC"}, \
75 {I_REFERENCED, "I_REFERENCED"} \
76 )
77 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,0,0)) */
78
79 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,0,0))
80
81 LTTNG_TRACEPOINT_EVENT(writeback_dirty_page,
82 TP_PROTO(struct page *page, struct address_space *mapping),
83 TP_ARGS(page, mapping),
84 TP_FIELDS(
85 ctf_array_text(char, name,
86 mapping ? dev_name(lttng_inode_to_bdi(mapping->host)->dev) : "(unknown)", 32)
87 ctf_integer(unsigned long, ino, mapping ? mapping->host->i_ino : 0)
88 ctf_integer(pgoff_t, index, page->index)
89 )
90 )
91
92 LTTNG_TRACEPOINT_EVENT_CLASS(writeback_dirty_inode_template,
93 TP_PROTO(struct inode *inode, int flags),
94 TP_ARGS(inode, flags),
95 TP_FIELDS(
96 /* may be called for files on pseudo FSes w/ unregistered bdi */
97 ctf_array_text(char, name,
98 lttng_inode_to_bdi(inode)->dev ?
99 dev_name(lttng_inode_to_bdi(inode)->dev) : "(unknown)", 32)
100 ctf_integer(unsigned long, ino, inode->i_ino)
101 ctf_integer(unsigned long, state, inode->i_state)
102 ctf_integer(unsigned long, flags, flags)
103 )
104 )
105 #define LTTNG_TRACEPOINT_EVENT_WRITEBACK_DIRTY_INODE_TEMPLATE(name) \
106 LTTNG_TRACEPOINT_EVENT_INSTANCE(writeback_dirty_inode_template, name, \
107 TP_PROTO(struct inode *inode, int flags), \
108 TP_ARGS(inode, flags))
109 LTTNG_TRACEPOINT_EVENT_WRITEBACK_DIRTY_INODE_TEMPLATE(writeback_dirty_inode_start)
110 LTTNG_TRACEPOINT_EVENT_WRITEBACK_DIRTY_INODE_TEMPLATE(writeback_dirty_inode)
111 LTTNG_TRACEPOINT_EVENT_WRITEBACK_DIRTY_INODE_TEMPLATE(writeback_mark_inode_dirty)
112
113 LTTNG_TRACEPOINT_EVENT_CLASS(writeback_write_inode_template,
114 TP_PROTO(struct inode *inode, struct writeback_control *wbc),
115 TP_ARGS(inode, wbc),
116 TP_FIELDS(
117 ctf_array_text(char, name,
118 dev_name(lttng_inode_to_bdi(inode)->dev), 32)
119 ctf_integer(unsigned long, ino, inode->i_ino)
120 ctf_integer(int, sync_mode, wbc->sync_mode)
121 )
122 )
123
124 #define LTTNG_TRACEPOINT_EVENT_WRITEBACK_WRITE_INODE(name) \
125 LTTNG_TRACEPOINT_EVENT_INSTANCE(writeback_write_inode_template, name, \
126 TP_PROTO(struct inode *inode, struct writeback_control *wbc), \
127 TP_ARGS(inode, wbc))
128 LTTNG_TRACEPOINT_EVENT_WRITEBACK_WRITE_INODE(writeback_write_inode_start)
129 LTTNG_TRACEPOINT_EVENT_WRITEBACK_WRITE_INODE(writeback_write_inode)
130
131 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0))
132
133 LTTNG_TRACEPOINT_EVENT(writeback_dirty_page,
134 TP_PROTO(struct page *page, struct address_space *mapping),
135 TP_ARGS(page, mapping),
136 TP_FIELDS(
137 ctf_array_text(char, name,
138 mapping ? dev_name(mapping->backing_dev_info->dev) : "(unknown)", 32)
139 ctf_integer(unsigned long, ino, mapping ? mapping->host->i_ino : 0)
140 ctf_integer(pgoff_t, index, page->index)
141 )
142 )
143
144 LTTNG_TRACEPOINT_EVENT_CLASS(writeback_dirty_inode_template,
145 TP_PROTO(struct inode *inode, int flags),
146 TP_ARGS(inode, flags),
147 TP_FIELDS(
148 /* may be called for files on pseudo FSes w/ unregistered bdi */
149 ctf_array_text(char, name,
150 inode->i_mapping->backing_dev_info->dev ?
151 dev_name(inode->i_mapping->backing_dev_info->dev)
152 : "(unknown)", 32)
153 ctf_integer(unsigned long, ino, inode->i_ino)
154 ctf_integer(unsigned long, flags, flags)
155 )
156 )
157 #define LTTNG_TRACEPOINT_EVENT_WRITEBACK_DIRTY_INODE_TEMPLATE(name) \
158 LTTNG_TRACEPOINT_EVENT_INSTANCE(writeback_dirty_inode_template, name, \
159 TP_PROTO(struct inode *inode, int flags), \
160 TP_ARGS(inode, flags))
161 LTTNG_TRACEPOINT_EVENT_WRITEBACK_DIRTY_INODE_TEMPLATE(writeback_dirty_inode_start)
162 LTTNG_TRACEPOINT_EVENT_WRITEBACK_DIRTY_INODE_TEMPLATE(writeback_dirty_inode)
163
164 LTTNG_TRACEPOINT_EVENT_CLASS(writeback_write_inode_template,
165 TP_PROTO(struct inode *inode, struct writeback_control *wbc),
166 TP_ARGS(inode, wbc),
167 TP_FIELDS(
168 ctf_array_text(char, name,
169 dev_name(inode->i_mapping->backing_dev_info->dev), 32)
170 ctf_integer(unsigned long, ino, inode->i_ino)
171 ctf_integer(int, sync_mode, wbc->sync_mode)
172 )
173 )
174
175 #define LTTNG_TRACEPOINT_EVENT_WRITEBACK_WRITE_INODE(name) \
176 LTTNG_TRACEPOINT_EVENT_INSTANCE(writeback_write_inode_template, name, \
177 TP_PROTO(struct inode *inode, struct writeback_control *wbc), \
178 TP_ARGS(inode, wbc))
179 LTTNG_TRACEPOINT_EVENT_WRITEBACK_WRITE_INODE(writeback_write_inode_start)
180 LTTNG_TRACEPOINT_EVENT_WRITEBACK_WRITE_INODE(writeback_write_inode)
181
182 #endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0)) */
183
184 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,3,0))
185
186 LTTNG_TRACEPOINT_EVENT_CLASS(writeback_work_class,
187 TP_PROTO(struct bdi_writeback *wb, struct wb_writeback_work *work),
188 TP_ARGS(wb, work),
189 TP_FIELDS(
190 ctf_array_text(char, name, wb->bdi->dev ? dev_name(wb->bdi->dev) :
191 "(unknown)", 32)
192 )
193 )
194
195 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,0,0))
196
197 LTTNG_TRACEPOINT_EVENT_CLASS(writeback_work_class,
198 TP_PROTO(struct backing_dev_info *bdi, struct wb_writeback_work *work),
199 TP_ARGS(bdi, work),
200 TP_FIELDS(
201 ctf_array_text(char, name, bdi->dev ? dev_name(bdi->dev) :
202 "(unknown)", 32)
203 )
204 )
205
206 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,0,0)) */
207
208 LTTNG_TRACEPOINT_EVENT_CLASS(writeback_work_class,
209 TP_PROTO(struct backing_dev_info *bdi, struct wb_writeback_work *work),
210 TP_ARGS(bdi, work),
211 TP_FIELDS(
212 ctf_array_text(char, name,
213 dev_name(bdi->dev ? bdi->dev :
214 default_backing_dev_info.dev), 32)
215 )
216 )
217
218 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,0,0)) */
219
220 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,3,0))
221
222 #define LTTNG_TRACEPOINT_EVENT_WRITEBACK_WORK_INSTANCE(name) \
223 LTTNG_TRACEPOINT_EVENT_INSTANCE(writeback_work_class, name, \
224 TP_PROTO(struct bdi_writeback *wb, struct wb_writeback_work *work), \
225 TP_ARGS(wb, work))
226
227 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,3,0)) */
228
229 #define LTTNG_TRACEPOINT_EVENT_WRITEBACK_WORK_INSTANCE(name) \
230 LTTNG_TRACEPOINT_EVENT_INSTANCE(writeback_work_class, name, \
231 TP_PROTO(struct backing_dev_info *bdi, struct wb_writeback_work *work), \
232 TP_ARGS(bdi, work))
233
234 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,3,0)) */
235
236 LTTNG_TRACEPOINT_EVENT_WRITEBACK_WORK_INSTANCE(writeback_nothread)
237 LTTNG_TRACEPOINT_EVENT_WRITEBACK_WORK_INSTANCE(writeback_queue)
238 LTTNG_TRACEPOINT_EVENT_WRITEBACK_WORK_INSTANCE(writeback_exec)
239 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0))
240 LTTNG_TRACEPOINT_EVENT_WRITEBACK_WORK_INSTANCE(writeback_start)
241 LTTNG_TRACEPOINT_EVENT_WRITEBACK_WORK_INSTANCE(writeback_written)
242 LTTNG_TRACEPOINT_EVENT_WRITEBACK_WORK_INSTANCE(writeback_wait)
243 #endif
244
245 LTTNG_TRACEPOINT_EVENT(writeback_pages_written,
246 TP_PROTO(long pages_written),
247 TP_ARGS(pages_written),
248 TP_FIELDS(
249 ctf_integer(long, pages, pages_written)
250 )
251 )
252
253 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,3,0))
254
255 LTTNG_TRACEPOINT_EVENT_CLASS(writeback_class,
256 TP_PROTO(struct bdi_writeback *wb),
257 TP_ARGS(wb),
258 TP_FIELDS(
259 ctf_array_text(char, name,
260 dev_name(wb->bdi->dev), 32)
261 )
262 )
263
264 #undef DEFINE_WRITEBACK_EVENT
265 #define DEFINE_WRITEBACK_EVENT(name) \
266 LTTNG_TRACEPOINT_EVENT_INSTANCE(writeback_class, name, \
267 TP_PROTO(struct bdi_writeback *wb), \
268 TP_ARGS(wb))
269
270 #define DEFINE_WRITEBACK_EVENT_MAP(name, map) \
271 LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(writeback_class, name, map, \
272 TP_PROTO(struct bdi_writeback *wb), \
273 TP_ARGS(wb))
274
275 LTTNG_TRACEPOINT_EVENT(writeback_bdi_register,
276 TP_PROTO(struct backing_dev_info *bdi),
277 TP_ARGS(bdi),
278 TP_FIELDS(
279 ctf_array_text(char, name,
280 dev_name(bdi->dev), 32)
281 )
282 )
283
284 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,3,0)) */
285
286 LTTNG_TRACEPOINT_EVENT_CLASS(writeback_class,
287 TP_PROTO(struct backing_dev_info *bdi),
288 TP_ARGS(bdi),
289 TP_FIELDS(
290 ctf_array_text(char, name,
291 dev_name(bdi->dev), 32)
292 )
293 )
294
295 #undef DEFINE_WRITEBACK_EVENT
296 #define DEFINE_WRITEBACK_EVENT(name) \
297 LTTNG_TRACEPOINT_EVENT_INSTANCE(writeback_class, name, \
298 TP_PROTO(struct backing_dev_info *bdi), \
299 TP_ARGS(bdi))
300
301 #define DEFINE_WRITEBACK_EVENT_MAP(name, map) \
302 LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(writeback_class, name, map, \
303 TP_PROTO(struct backing_dev_info *bdi), \
304 TP_ARGS(bdi))
305
306 DEFINE_WRITEBACK_EVENT(writeback_bdi_register)
307
308 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,3,0)) */
309
310 DEFINE_WRITEBACK_EVENT(writeback_nowork)
311 DEFINE_WRITEBACK_EVENT(writeback_wake_background)
312 DEFINE_WRITEBACK_EVENT(writeback_wake_thread)
313 DEFINE_WRITEBACK_EVENT(writeback_wake_forker_thread)
314 DEFINE_WRITEBACK_EVENT(writeback_bdi_unregister)
315 DEFINE_WRITEBACK_EVENT(writeback_thread_start)
316 DEFINE_WRITEBACK_EVENT(writeback_thread_stop)
317 #if (LTTNG_KERNEL_RANGE(3,1,0, 3,2,0))
318 DEFINE_WRITEBACK_EVENT_MAP(balance_dirty_start, writeback_balance_dirty_start)
319 DEFINE_WRITEBACK_EVENT_MAP(balance_dirty_wait, writeback_balance_dirty_wait)
320
321 LTTNG_TRACEPOINT_EVENT_MAP(balance_dirty_written,
322
323 writeback_balance_dirty_written,
324
325 TP_PROTO(struct backing_dev_info *bdi, int written),
326
327 TP_ARGS(bdi, written),
328
329 TP_FIELDS(
330 ctf_array_text(char, name, dev_name(bdi->dev), 32)
331 ctf_integer(int, written, written)
332 )
333 )
334 #endif
335
336 LTTNG_TRACEPOINT_EVENT_CLASS(writeback_wbc_class,
337 TP_PROTO(struct writeback_control *wbc, struct backing_dev_info *bdi),
338 TP_ARGS(wbc, bdi),
339 TP_FIELDS(
340 ctf_array_text(char, name, dev_name(bdi->dev), 32)
341 ctf_integer(long, nr_to_write, wbc->nr_to_write)
342 ctf_integer(long, pages_skipped, wbc->pages_skipped)
343 ctf_integer(int, sync_mode, wbc->sync_mode)
344 ctf_integer(int, for_kupdate, wbc->for_kupdate)
345 ctf_integer(int, for_background, wbc->for_background)
346 ctf_integer(int, for_reclaim, wbc->for_reclaim)
347 ctf_integer(int, range_cyclic, wbc->range_cyclic)
348 #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,1,0))
349 ctf_integer(int, more_io, wbc->more_io)
350 ctf_integer(unsigned long, older_than_this,
351 wbc->older_than_this ? *wbc->older_than_this : 0)
352 #endif
353 ctf_integer(long, range_start, (long) wbc->range_start)
354 ctf_integer(long, range_end, (long) wbc->range_end)
355 )
356 )
357
358 #undef DEFINE_WBC_EVENT
359 #define LTTNG_TRACEPOINT_EVENT_WBC_INSTANCE(name, map) \
360 LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(writeback_wbc_class, name, map, \
361 TP_PROTO(struct writeback_control *wbc, struct backing_dev_info *bdi), \
362 TP_ARGS(wbc, bdi))
363 #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,1,0))
364 LTTNG_TRACEPOINT_EVENT_WBC_INSTANCE(wbc_writeback_start, writeback_wbc_writeback_start)
365 LTTNG_TRACEPOINT_EVENT_WBC_INSTANCE(wbc_writeback_written, writeback_wbc_writeback_written)
366 LTTNG_TRACEPOINT_EVENT_WBC_INSTANCE(wbc_writeback_wait, writeback_wbc_writeback_wait)
367 LTTNG_TRACEPOINT_EVENT_WBC_INSTANCE(wbc_balance_dirty_start, writeback_wbc_balance_dirty_start)
368 LTTNG_TRACEPOINT_EVENT_WBC_INSTANCE(wbc_balance_dirty_written, writeback_wbc_balance_dirty_written)
369 LTTNG_TRACEPOINT_EVENT_WBC_INSTANCE(wbc_balance_dirty_wait, writeback_wbc_balance_dirty_wait)
370 #endif
371 LTTNG_TRACEPOINT_EVENT_WBC_INSTANCE(wbc_writepage, writeback_wbc_writepage)
372
373 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0))
374 LTTNG_TRACEPOINT_EVENT(writeback_queue_io,
375 TP_PROTO(struct bdi_writeback *wb,
376 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
377 struct wb_writeback_work *work,
378 #else
379 unsigned long *older_than_this,
380 #endif
381 int moved),
382 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
383 TP_ARGS(wb, work, moved),
384 #else
385 TP_ARGS(wb, older_than_this, moved),
386 #endif
387 TP_FIELDS(
388 ctf_array_text(char, name, dev_name(wb->bdi->dev), 32)
389 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
390 #else
391 ctf_integer(unsigned long, older,
392 older_than_this ? *older_than_this : 0)
393 ctf_integer(long, age,
394 older_than_this ?
395 (jiffies - *older_than_this) * 1000 / HZ
396 : -1)
397 #endif
398 ctf_integer(int, moved, moved)
399 )
400 )
401
402 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0))
403 LTTNG_TRACEPOINT_EVENT_MAP(global_dirty_state,
404
405 writeback_global_dirty_state,
406
407 TP_PROTO(unsigned long background_thresh,
408 unsigned long dirty_thresh
409 ),
410
411 TP_ARGS(background_thresh,
412 dirty_thresh
413 ),
414
415 TP_FIELDS(
416 ctf_integer(unsigned long, nr_dirty, global_node_page_state(NR_FILE_DIRTY))
417 ctf_integer(unsigned long, nr_writeback, global_node_page_state(NR_WRITEBACK))
418 ctf_integer(unsigned long, nr_unstable, global_node_page_state(NR_UNSTABLE_NFS))
419 ctf_integer(unsigned long, nr_dirtied, global_node_page_state(NR_DIRTIED))
420 ctf_integer(unsigned long, nr_written, global_node_page_state(NR_WRITTEN))
421 ctf_integer(unsigned long, background_thresh, background_thresh)
422 ctf_integer(unsigned long, dirty_thresh, dirty_thresh)
423 ctf_integer(unsigned long, dirty_limit, global_dirty_limit)
424 )
425 )
426 #else
427 LTTNG_TRACEPOINT_EVENT_MAP(global_dirty_state,
428
429 writeback_global_dirty_state,
430
431 TP_PROTO(unsigned long background_thresh,
432 unsigned long dirty_thresh
433 ),
434
435 TP_ARGS(background_thresh,
436 dirty_thresh
437 ),
438
439 TP_FIELDS(
440 ctf_integer(unsigned long, nr_dirty, global_page_state(NR_FILE_DIRTY))
441 ctf_integer(unsigned long, nr_writeback, global_page_state(NR_WRITEBACK))
442 ctf_integer(unsigned long, nr_unstable, global_page_state(NR_UNSTABLE_NFS))
443 ctf_integer(unsigned long, nr_dirtied, global_page_state(NR_DIRTIED))
444 ctf_integer(unsigned long, nr_written, global_page_state(NR_WRITTEN))
445 ctf_integer(unsigned long, background_thresh, background_thresh)
446 ctf_integer(unsigned long, dirty_thresh, dirty_thresh)
447 ctf_integer(unsigned long, dirty_limit, global_dirty_limit)
448 )
449 )
450 #endif
451 #endif
452
453 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
454
455 #define KBps(x) ((x) << (PAGE_SHIFT - 10))
456
457 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,3,0))
458
459 LTTNG_TRACEPOINT_EVENT_MAP(bdi_dirty_ratelimit,
460
461 writeback_bdi_dirty_ratelimit,
462
463 TP_PROTO(struct bdi_writeback *wb,
464 unsigned long dirty_rate,
465 unsigned long task_ratelimit),
466
467 TP_ARGS(wb, dirty_rate, task_ratelimit),
468
469 TP_FIELDS(
470 ctf_array_text(char, bdi, dev_name(wb->bdi->dev), 32)
471 ctf_integer(unsigned long, write_bw, KBps(wb->bdi->wb.write_bandwidth))
472 ctf_integer(unsigned long, avg_write_bw, KBps(wb->bdi->wb.avg_write_bandwidth))
473 ctf_integer(unsigned long, dirty_rate, KBps(dirty_rate))
474 ctf_integer(unsigned long, dirty_ratelimit, KBps(wb->bdi->wb.dirty_ratelimit))
475 ctf_integer(unsigned long, task_ratelimit, KBps(task_ratelimit))
476 ctf_integer(unsigned long, balanced_dirty_ratelimit,
477 KBps(wb->bdi->wb.balanced_dirty_ratelimit))
478 )
479 )
480
481 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,2,0))
482
483 LTTNG_TRACEPOINT_EVENT_MAP(bdi_dirty_ratelimit,
484
485 writeback_bdi_dirty_ratelimit,
486
487 TP_PROTO(struct backing_dev_info *bdi,
488 unsigned long dirty_rate,
489 unsigned long task_ratelimit),
490
491 TP_ARGS(bdi, dirty_rate, task_ratelimit),
492
493 TP_FIELDS(
494 ctf_array_text(char, bdi, dev_name(bdi->dev), 32)
495 ctf_integer(unsigned long, write_bw, KBps(bdi->wb.write_bandwidth))
496 ctf_integer(unsigned long, avg_write_bw, KBps(bdi->wb.avg_write_bandwidth))
497 ctf_integer(unsigned long, dirty_rate, KBps(dirty_rate))
498 ctf_integer(unsigned long, dirty_ratelimit, KBps(bdi->wb.dirty_ratelimit))
499 ctf_integer(unsigned long, task_ratelimit, KBps(task_ratelimit))
500 ctf_integer(unsigned long, balanced_dirty_ratelimit,
501 KBps(bdi->wb.balanced_dirty_ratelimit))
502 )
503 )
504
505 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,2,0)) */
506
507 LTTNG_TRACEPOINT_EVENT_MAP(bdi_dirty_ratelimit,
508
509 writeback_bdi_dirty_ratelimit,
510
511 TP_PROTO(struct backing_dev_info *bdi,
512 unsigned long dirty_rate,
513 unsigned long task_ratelimit),
514
515 TP_ARGS(bdi, dirty_rate, task_ratelimit),
516
517 TP_FIELDS(
518 ctf_array_text(char, bdi, dev_name(bdi->dev), 32)
519 ctf_integer(unsigned long, write_bw, KBps(bdi->write_bandwidth))
520 ctf_integer(unsigned long, avg_write_bw, KBps(bdi->avg_write_bandwidth))
521 ctf_integer(unsigned long, dirty_rate, KBps(dirty_rate))
522 ctf_integer(unsigned long, dirty_ratelimit, KBps(bdi->dirty_ratelimit))
523 ctf_integer(unsigned long, task_ratelimit, KBps(task_ratelimit))
524 ctf_integer(unsigned long, balanced_dirty_ratelimit,
525 KBps(bdi->balanced_dirty_ratelimit))
526 )
527 )
528
529 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,2,0)) */
530
531 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,3,0))
532
533 LTTNG_TRACEPOINT_EVENT_MAP(balance_dirty_pages,
534
535 writeback_balance_dirty_pages,
536
537 TP_PROTO(struct bdi_writeback *wb,
538 unsigned long thresh,
539 unsigned long bg_thresh,
540 unsigned long dirty,
541 unsigned long bdi_thresh,
542 unsigned long bdi_dirty,
543 unsigned long dirty_ratelimit,
544 unsigned long task_ratelimit,
545 unsigned long dirtied,
546 unsigned long period,
547 long pause,
548 unsigned long start_time),
549
550 TP_ARGS(wb, thresh, bg_thresh, dirty, bdi_thresh, bdi_dirty,
551 dirty_ratelimit, task_ratelimit,
552 dirtied, period, pause, start_time
553 ),
554
555 TP_FIELDS(
556 ctf_array_text(char, bdi, dev_name(wb->bdi->dev), 32)
557 ctf_integer(unsigned long, limit, global_dirty_limit)
558 ctf_integer(unsigned long, setpoint,
559 (global_dirty_limit + (thresh + bg_thresh) / 2) / 2)
560 ctf_integer(unsigned long, dirty, dirty)
561 ctf_integer(unsigned long, bdi_setpoint,
562 ((global_dirty_limit + (thresh + bg_thresh) / 2) / 2) *
563 bdi_thresh / (thresh + 1))
564 ctf_integer(unsigned long, bdi_dirty, bdi_dirty)
565 ctf_integer(unsigned long, dirty_ratelimit,
566 KBps(dirty_ratelimit))
567 ctf_integer(unsigned long, task_ratelimit,
568 KBps(task_ratelimit))
569 ctf_integer(unsigned int, dirtied, dirtied)
570 ctf_integer(unsigned int, dirtied_pause,
571 current->nr_dirtied_pause)
572 ctf_integer(unsigned long, paused,
573 (jiffies - start_time) * 1000 / HZ)
574 ctf_integer(long, pause, pause * 1000 / HZ)
575 ctf_integer(unsigned long, period,
576 period * 1000 / HZ)
577 ctf_integer(long, think,
578 current->dirty_paused_when == 0 ? 0 :
579 (long)(jiffies - current->dirty_paused_when) * 1000/HZ)
580 )
581 )
582
583 #else /* #if LINUX_VERSION_CODE >= KERNEL_VERSION(4,3,0)) */
584
585 LTTNG_TRACEPOINT_EVENT_MAP(balance_dirty_pages,
586
587 writeback_balance_dirty_pages,
588
589 TP_PROTO(struct backing_dev_info *bdi,
590 unsigned long thresh,
591 unsigned long bg_thresh,
592 unsigned long dirty,
593 unsigned long bdi_thresh,
594 unsigned long bdi_dirty,
595 unsigned long dirty_ratelimit,
596 unsigned long task_ratelimit,
597 unsigned long dirtied,
598 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0))
599 unsigned long period,
600 #endif
601 long pause,
602 unsigned long start_time),
603
604 TP_ARGS(bdi, thresh, bg_thresh, dirty, bdi_thresh, bdi_dirty,
605 dirty_ratelimit, task_ratelimit,
606 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0))
607 dirtied, period, pause, start_time
608 #else
609 dirtied, pause, start_time
610 #endif
611 ),
612
613 TP_FIELDS(
614 ctf_array_text(char, bdi, dev_name(bdi->dev), 32)
615 ctf_integer(unsigned long, limit, global_dirty_limit)
616 ctf_integer(unsigned long, setpoint,
617 (global_dirty_limit + (thresh + bg_thresh) / 2) / 2)
618 ctf_integer(unsigned long, dirty, dirty)
619 ctf_integer(unsigned long, bdi_setpoint,
620 ((global_dirty_limit + (thresh + bg_thresh) / 2) / 2) *
621 bdi_thresh / (thresh + 1))
622 ctf_integer(unsigned long, bdi_dirty, bdi_dirty)
623 ctf_integer(unsigned long, dirty_ratelimit,
624 KBps(dirty_ratelimit))
625 ctf_integer(unsigned long, task_ratelimit,
626 KBps(task_ratelimit))
627 ctf_integer(unsigned int, dirtied, dirtied)
628 ctf_integer(unsigned int, dirtied_pause,
629 current->nr_dirtied_pause)
630 ctf_integer(unsigned long, paused,
631 (jiffies - start_time) * 1000 / HZ)
632 ctf_integer(long, pause, pause * 1000 / HZ)
633 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0))
634 ctf_integer(unsigned long, period,
635 period * 1000 / HZ)
636 ctf_integer(long, think,
637 current->dirty_paused_when == 0 ? 0 :
638 (long)(jiffies - current->dirty_paused_when) * 1000/HZ)
639 #endif
640 )
641 )
642 #endif /* #else #if LINUX_VERSION_CODE >= KERNEL_VERSION(4,3,0)) */
643
644 #endif /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0)) */
645
646 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0))
647 LTTNG_TRACEPOINT_EVENT(writeback_sb_inodes_requeue,
648
649 TP_PROTO(struct inode *inode),
650 TP_ARGS(inode),
651
652 TP_FIELDS(
653 ctf_array_text(char, name,
654 dev_name(lttng_inode_to_bdi(inode)->dev), 32)
655 ctf_integer(unsigned long, ino, inode->i_ino)
656 ctf_integer(unsigned long, state, inode->i_state)
657 ctf_integer(unsigned long, dirtied_when, inode->dirtied_when)
658 )
659 )
660 #endif
661
662 LTTNG_TRACEPOINT_EVENT_CLASS(writeback_congest_waited_template,
663
664 TP_PROTO(unsigned int usec_timeout, unsigned int usec_delayed),
665
666 TP_ARGS(usec_timeout, usec_delayed),
667
668 TP_FIELDS(
669 ctf_integer(unsigned int, usec_timeout, usec_timeout)
670 ctf_integer(unsigned int, usec_delayed, usec_delayed)
671 )
672 )
673
674 LTTNG_TRACEPOINT_EVENT_INSTANCE(writeback_congest_waited_template, writeback_congestion_wait,
675
676 TP_PROTO(unsigned int usec_timeout, unsigned int usec_delayed),
677
678 TP_ARGS(usec_timeout, usec_delayed)
679 )
680
681 LTTNG_TRACEPOINT_EVENT_INSTANCE(writeback_congest_waited_template, writeback_wait_iff_congested,
682
683 TP_PROTO(unsigned int usec_timeout, unsigned int usec_delayed),
684
685 TP_ARGS(usec_timeout, usec_delayed)
686 )
687
688 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0))
689 LTTNG_TRACEPOINT_EVENT_CLASS(writeback_single_inode_template,
690
691 TP_PROTO(struct inode *inode,
692 struct writeback_control *wbc,
693 unsigned long nr_to_write
694 ),
695
696 TP_ARGS(inode, wbc, nr_to_write),
697
698 TP_FIELDS(
699 ctf_array_text(char, name,
700 dev_name(lttng_inode_to_bdi(inode)->dev), 32)
701 ctf_integer(unsigned long, ino, inode->i_ino)
702 ctf_integer(unsigned long, state, inode->i_state)
703 ctf_integer(unsigned long, dirtied_when, inode->dirtied_when)
704 ctf_integer(unsigned long, writeback_index,
705 inode->i_mapping->writeback_index)
706 ctf_integer(long, nr_to_write, nr_to_write)
707 ctf_integer(unsigned long, wrote,
708 nr_to_write - wbc->nr_to_write)
709 )
710 )
711
712 #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0))
713 LTTNG_TRACEPOINT_EVENT_INSTANCE(writeback_single_inode_template, writeback_single_inode_requeue,
714 TP_PROTO(struct inode *inode,
715 struct writeback_control *wbc,
716 unsigned long nr_to_write),
717 TP_ARGS(inode, wbc, nr_to_write)
718 )
719 #endif
720
721 LTTNG_TRACEPOINT_EVENT_INSTANCE(writeback_single_inode_template, writeback_single_inode,
722 TP_PROTO(struct inode *inode,
723 struct writeback_control *wbc,
724 unsigned long nr_to_write),
725 TP_ARGS(inode, wbc, nr_to_write)
726 )
727 #endif
728
729 #endif /* LTTNG_TRACE_WRITEBACK_H */
730
731 /* This part must be outside protection */
732 #include <lttng/define_trace.h>
This page took 0.043025 seconds and 3 git commands to generate.