1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #define TRACE_SYSTEM writeback
5 #if !defined(LTTNG_TRACE_WRITEBACK_H) || defined(TRACE_HEADER_MULTI_READ)
6 #define LTTNG_TRACE_WRITEBACK_H
8 #include <probes/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>
14 #ifndef _TRACE_WRITEBACK_DEF_
15 #define _TRACE_WRITEBACK_DEF_
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.
25 #if (LINUX_VERSION_CODE < KERNEL_VERSION(4,0,0))
26 static inline struct backing_dev_info
*lttng_inode_to_bdi(struct inode
*inode
)
28 struct super_block
*sb
;
31 return &noop_backing_dev_info
;
35 if (strcmp(sb
->s_type
->name
, "bdev") == 0)
36 return inode
->i_mapping
->backing_dev_info
;
41 static inline struct backing_dev_info
*lttng_inode_to_bdi(struct inode
*inode
)
43 return inode_to_bdi(inode
);
45 #endif /* #if (LINUX_VERSION_CODE < KERNEL_VERSION(4,0,0)) */
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"}, \
56 {I_WILL_FREE, "I_WILL_FREE"}, \
57 {I_FREEING, "I_FREEING"}, \
58 {I_CLEAR, "I_CLEAR"}, \
60 {I_DIRTY_TIME, "I_DIRTY_TIME"}, \
61 {I_DIRTY_TIME_EXPIRED, "I_DIRTY_TIME_EXPIRED"}, \
62 {I_REFERENCED, "I_REFERENCED"} \
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"}, \
71 {I_WILL_FREE, "I_WILL_FREE"}, \
72 {I_FREEING, "I_FREEING"}, \
73 {I_CLEAR, "I_CLEAR"}, \
75 {I_REFERENCED, "I_REFERENCED"} \
77 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,0,0)) */
79 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,0,0))
81 LTTNG_TRACEPOINT_EVENT(writeback_dirty_page
,
82 TP_PROTO(struct page
*page
, struct address_space
*mapping
),
83 TP_ARGS(page
, mapping
),
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
)
92 LTTNG_TRACEPOINT_EVENT_CLASS(writeback_dirty_inode_template
,
93 TP_PROTO(struct inode
*inode
, int flags
),
94 TP_ARGS(inode
, flags
),
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
)
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
)
113 LTTNG_TRACEPOINT_EVENT_CLASS(writeback_write_inode_template
,
114 TP_PROTO(struct inode
*inode
, struct writeback_control
*wbc
),
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
)
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), \
128 LTTNG_TRACEPOINT_EVENT_WRITEBACK_WRITE_INODE(writeback_write_inode_start
)
129 LTTNG_TRACEPOINT_EVENT_WRITEBACK_WRITE_INODE(writeback_write_inode
)
131 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0))
133 LTTNG_TRACEPOINT_EVENT(writeback_dirty_page
,
134 TP_PROTO(struct page
*page
, struct address_space
*mapping
),
135 TP_ARGS(page
, mapping
),
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
)
144 LTTNG_TRACEPOINT_EVENT_CLASS(writeback_dirty_inode_template
,
145 TP_PROTO(struct inode
*inode
, int flags
),
146 TP_ARGS(inode
, flags
),
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
)
153 ctf_integer(unsigned long, ino
, inode
->i_ino
)
154 ctf_integer(unsigned long, flags
, flags
)
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
)
164 LTTNG_TRACEPOINT_EVENT_CLASS(writeback_write_inode_template
,
165 TP_PROTO(struct inode
*inode
, struct writeback_control
*wbc
),
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
)
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), \
179 LTTNG_TRACEPOINT_EVENT_WRITEBACK_WRITE_INODE(writeback_write_inode_start
)
180 LTTNG_TRACEPOINT_EVENT_WRITEBACK_WRITE_INODE(writeback_write_inode
)
182 #endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0)) */
184 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,3,0))
186 LTTNG_TRACEPOINT_EVENT_CLASS(writeback_work_class
,
187 TP_PROTO(struct bdi_writeback
*wb
, struct wb_writeback_work
*work
),
190 ctf_array_text(char, name
, wb
->bdi
->dev
? dev_name(wb
->bdi
->dev
) :
195 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,0,0))
197 LTTNG_TRACEPOINT_EVENT_CLASS(writeback_work_class
,
198 TP_PROTO(struct backing_dev_info
*bdi
, struct wb_writeback_work
*work
),
201 ctf_array_text(char, name
, bdi
->dev
? dev_name(bdi
->dev
) :
206 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,0,0)) */
208 LTTNG_TRACEPOINT_EVENT_CLASS(writeback_work_class
,
209 TP_PROTO(struct backing_dev_info
*bdi
, struct wb_writeback_work
*work
),
212 ctf_array_text(char, name
,
213 dev_name(bdi
->dev
? bdi
->dev
:
214 default_backing_dev_info
.dev
), 32)
218 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,0,0)) */
220 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,3,0))
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), \
227 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,3,0)) */
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), \
234 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,3,0)) */
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
)
245 LTTNG_TRACEPOINT_EVENT(writeback_pages_written
,
246 TP_PROTO(long pages_written
),
247 TP_ARGS(pages_written
),
249 ctf_integer(long, pages
, pages_written
)
253 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,3,0))
255 LTTNG_TRACEPOINT_EVENT_CLASS(writeback_class
,
256 TP_PROTO(struct bdi_writeback
*wb
),
259 ctf_array_text(char, name
,
260 dev_name(wb
->bdi
->dev
), 32)
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), \
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), \
275 LTTNG_TRACEPOINT_EVENT(writeback_bdi_register
,
276 TP_PROTO(struct backing_dev_info
*bdi
),
279 ctf_array_text(char, name
,
280 dev_name(bdi
->dev
), 32)
284 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,3,0)) */
286 LTTNG_TRACEPOINT_EVENT_CLASS(writeback_class
,
287 TP_PROTO(struct backing_dev_info
*bdi
),
290 ctf_array_text(char, name
,
291 dev_name(bdi
->dev
), 32)
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), \
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), \
306 DEFINE_WRITEBACK_EVENT(writeback_bdi_register
)
308 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,3,0)) */
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
)
321 LTTNG_TRACEPOINT_EVENT_MAP(balance_dirty_written
,
323 writeback_balance_dirty_written
,
325 TP_PROTO(struct backing_dev_info
*bdi
, int written
),
327 TP_ARGS(bdi
, written
),
330 ctf_array_text(char, name
, dev_name(bdi
->dev
), 32)
331 ctf_integer(int, written
, written
)
336 LTTNG_TRACEPOINT_EVENT_CLASS(writeback_wbc_class
,
337 TP_PROTO(struct writeback_control
*wbc
, struct backing_dev_info
*bdi
),
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)
353 ctf_integer(long, range_start
, (long) wbc
->range_start
)
354 ctf_integer(long, range_end
, (long) wbc
->range_end
)
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), \
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
)
371 LTTNG_TRACEPOINT_EVENT_WBC_INSTANCE(wbc_writepage
, writeback_wbc_writepage
)
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
,
379 unsigned long *older_than_this
,
382 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
383 TP_ARGS(wb
, work
, moved
),
385 TP_ARGS(wb
, older_than_this
, moved
),
388 ctf_array_text(char, name
, dev_name(wb
->bdi
->dev
), 32)
389 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
391 ctf_integer(unsigned long, older
,
392 older_than_this
? *older_than_this
: 0)
393 ctf_integer(long, age
,
395 (jiffies
- *older_than_this
) * 1000 / HZ
398 ctf_integer(int, moved
, moved
)
402 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,7,0))
403 LTTNG_TRACEPOINT_EVENT_MAP(global_dirty_state
,
405 writeback_global_dirty_state
,
407 TP_PROTO(struct wb_domain
*domain
,
408 unsigned long background_thresh
,
409 unsigned long dirty_thresh
418 ctf_integer(unsigned long, nr_dirty
, global_node_page_state(NR_FILE_DIRTY
))
419 ctf_integer(unsigned long, nr_writeback
, global_node_page_state(NR_WRITEBACK
))
420 ctf_integer(unsigned long, nr_unstable
, global_node_page_state(NR_UNSTABLE_NFS
))
421 ctf_integer(unsigned long, nr_dirtied
, global_node_page_state(NR_DIRTIED
))
422 ctf_integer(unsigned long, nr_written
, global_node_page_state(NR_WRITTEN
))
423 ctf_integer(unsigned long, background_thresh
, background_thresh
)
424 ctf_integer(unsigned long, dirty_thresh
, dirty_thresh
)
425 ctf_integer(unsigned long, dirty_limit
, domain
->dirty_limit
)
428 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0))
429 LTTNG_TRACEPOINT_EVENT_MAP(global_dirty_state
,
431 writeback_global_dirty_state
,
433 TP_PROTO(unsigned long background_thresh
,
434 unsigned long dirty_thresh
437 TP_ARGS(background_thresh
,
442 ctf_integer(unsigned long, nr_dirty
, global_node_page_state(NR_FILE_DIRTY
))
443 ctf_integer(unsigned long, nr_writeback
, global_node_page_state(NR_WRITEBACK
))
444 ctf_integer(unsigned long, nr_unstable
, global_node_page_state(NR_UNSTABLE_NFS
))
445 ctf_integer(unsigned long, nr_dirtied
, global_node_page_state(NR_DIRTIED
))
446 ctf_integer(unsigned long, nr_written
, global_node_page_state(NR_WRITTEN
))
447 ctf_integer(unsigned long, background_thresh
, background_thresh
)
448 ctf_integer(unsigned long, dirty_thresh
, dirty_thresh
)
449 ctf_integer(unsigned long, dirty_limit
, global_dirty_limit
)
453 LTTNG_TRACEPOINT_EVENT_MAP(global_dirty_state
,
455 writeback_global_dirty_state
,
457 TP_PROTO(unsigned long background_thresh
,
458 unsigned long dirty_thresh
461 TP_ARGS(background_thresh
,
466 ctf_integer(unsigned long, nr_dirty
, global_page_state(NR_FILE_DIRTY
))
467 ctf_integer(unsigned long, nr_writeback
, global_page_state(NR_WRITEBACK
))
468 ctf_integer(unsigned long, nr_unstable
, global_page_state(NR_UNSTABLE_NFS
))
469 ctf_integer(unsigned long, nr_dirtied
, global_page_state(NR_DIRTIED
))
470 ctf_integer(unsigned long, nr_written
, global_page_state(NR_WRITTEN
))
471 ctf_integer(unsigned long, background_thresh
, background_thresh
)
472 ctf_integer(unsigned long, dirty_thresh
, dirty_thresh
)
473 ctf_integer(unsigned long, dirty_limit
, global_dirty_limit
)
479 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
481 #define KBps(x) ((x) << (PAGE_SHIFT - 10))
483 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,3,0))
485 LTTNG_TRACEPOINT_EVENT_MAP(bdi_dirty_ratelimit
,
487 writeback_bdi_dirty_ratelimit
,
489 TP_PROTO(struct bdi_writeback
*wb
,
490 unsigned long dirty_rate
,
491 unsigned long task_ratelimit
),
493 TP_ARGS(wb
, dirty_rate
, task_ratelimit
),
496 ctf_array_text(char, bdi
, dev_name(wb
->bdi
->dev
), 32)
497 ctf_integer(unsigned long, write_bw
, KBps(wb
->bdi
->wb
.write_bandwidth
))
498 ctf_integer(unsigned long, avg_write_bw
, KBps(wb
->bdi
->wb
.avg_write_bandwidth
))
499 ctf_integer(unsigned long, dirty_rate
, KBps(dirty_rate
))
500 ctf_integer(unsigned long, dirty_ratelimit
, KBps(wb
->bdi
->wb
.dirty_ratelimit
))
501 ctf_integer(unsigned long, task_ratelimit
, KBps(task_ratelimit
))
502 ctf_integer(unsigned long, balanced_dirty_ratelimit
,
503 KBps(wb
->bdi
->wb
.balanced_dirty_ratelimit
))
507 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,2,0))
509 LTTNG_TRACEPOINT_EVENT_MAP(bdi_dirty_ratelimit
,
511 writeback_bdi_dirty_ratelimit
,
513 TP_PROTO(struct backing_dev_info
*bdi
,
514 unsigned long dirty_rate
,
515 unsigned long task_ratelimit
),
517 TP_ARGS(bdi
, dirty_rate
, task_ratelimit
),
520 ctf_array_text(char, bdi
, dev_name(bdi
->dev
), 32)
521 ctf_integer(unsigned long, write_bw
, KBps(bdi
->wb
.write_bandwidth
))
522 ctf_integer(unsigned long, avg_write_bw
, KBps(bdi
->wb
.avg_write_bandwidth
))
523 ctf_integer(unsigned long, dirty_rate
, KBps(dirty_rate
))
524 ctf_integer(unsigned long, dirty_ratelimit
, KBps(bdi
->wb
.dirty_ratelimit
))
525 ctf_integer(unsigned long, task_ratelimit
, KBps(task_ratelimit
))
526 ctf_integer(unsigned long, balanced_dirty_ratelimit
,
527 KBps(bdi
->wb
.balanced_dirty_ratelimit
))
531 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,2,0)) */
533 LTTNG_TRACEPOINT_EVENT_MAP(bdi_dirty_ratelimit
,
535 writeback_bdi_dirty_ratelimit
,
537 TP_PROTO(struct backing_dev_info
*bdi
,
538 unsigned long dirty_rate
,
539 unsigned long task_ratelimit
),
541 TP_ARGS(bdi
, dirty_rate
, task_ratelimit
),
544 ctf_array_text(char, bdi
, dev_name(bdi
->dev
), 32)
545 ctf_integer(unsigned long, write_bw
, KBps(bdi
->write_bandwidth
))
546 ctf_integer(unsigned long, avg_write_bw
, KBps(bdi
->avg_write_bandwidth
))
547 ctf_integer(unsigned long, dirty_rate
, KBps(dirty_rate
))
548 ctf_integer(unsigned long, dirty_ratelimit
, KBps(bdi
->dirty_ratelimit
))
549 ctf_integer(unsigned long, task_ratelimit
, KBps(task_ratelimit
))
550 ctf_integer(unsigned long, balanced_dirty_ratelimit
,
551 KBps(bdi
->balanced_dirty_ratelimit
))
555 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,2,0)) */
557 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,7,0))
559 LTTNG_TRACEPOINT_EVENT_MAP(balance_dirty_pages
,
561 writeback_balance_dirty_pages
,
563 TP_PROTO(struct wb_domain
*domain
,
564 struct bdi_writeback
*wb
,
565 struct dirty_throttle_control
*sdtc
,
566 unsigned long dirty_ratelimit
,
567 unsigned long task_ratelimit
,
568 unsigned long dirtied
,
569 unsigned long period
,
571 unsigned long start_time
),
573 TP_ARGS(domain
, wb
, sdtc
,
574 dirty_ratelimit
, task_ratelimit
,
575 dirtied
, period
, pause
, start_time
579 ctf_array_text(char, bdi
, dev_name(wb
->bdi
->dev
), 32)
580 ctf_integer(unsigned long, limit
, domain
->dirty_limit
)
581 ctf_integer(unsigned long, setpoint
,
582 (domain
->dirty_limit
+ (sdtc
->thresh
+ sdtc
->bg_thresh
) / 2) / 2)
583 ctf_integer(unsigned long, dirty
, sdtc
->dirty
)
584 ctf_integer(unsigned long, bdi_setpoint
,
585 ((domain
->dirty_limit
+ (sdtc
->thresh
+ sdtc
->bg_thresh
) / 2) / 2) *
586 sdtc
->wb_thresh
/ (sdtc
->thresh
+ 1))
587 ctf_integer(unsigned long, bdi_dirty
, sdtc
->wb_dirty
)
588 ctf_integer(unsigned long, dirty_ratelimit
,
589 KBps(dirty_ratelimit
))
590 ctf_integer(unsigned long, task_ratelimit
,
591 KBps(task_ratelimit
))
592 ctf_integer(unsigned int, dirtied
, dirtied
)
593 ctf_integer(unsigned int, dirtied_pause
,
594 current
->nr_dirtied_pause
)
595 ctf_integer(unsigned long, paused
,
596 (jiffies
- start_time
) * 1000 / HZ
)
597 ctf_integer(long, pause
, pause
* 1000 / HZ
)
598 ctf_integer(unsigned long, period
,
600 ctf_integer(long, think
,
601 current
->dirty_paused_when
== 0 ? 0 :
602 (long)(jiffies
- current
->dirty_paused_when
) * 1000/HZ
)
606 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,3,0))
608 LTTNG_TRACEPOINT_EVENT_MAP(balance_dirty_pages
,
610 writeback_balance_dirty_pages
,
612 TP_PROTO(struct bdi_writeback
*wb
,
613 unsigned long thresh
,
614 unsigned long bg_thresh
,
616 unsigned long bdi_thresh
,
617 unsigned long bdi_dirty
,
618 unsigned long dirty_ratelimit
,
619 unsigned long task_ratelimit
,
620 unsigned long dirtied
,
621 unsigned long period
,
623 unsigned long start_time
),
625 TP_ARGS(wb
, thresh
, bg_thresh
, dirty
, bdi_thresh
, bdi_dirty
,
626 dirty_ratelimit
, task_ratelimit
,
627 dirtied
, period
, pause
, start_time
631 ctf_array_text(char, bdi
, dev_name(wb
->bdi
->dev
), 32)
632 ctf_integer(unsigned long, limit
, global_dirty_limit
)
633 ctf_integer(unsigned long, setpoint
,
634 (global_dirty_limit
+ (thresh
+ bg_thresh
) / 2) / 2)
635 ctf_integer(unsigned long, dirty
, dirty
)
636 ctf_integer(unsigned long, bdi_setpoint
,
637 ((global_dirty_limit
+ (thresh
+ bg_thresh
) / 2) / 2) *
638 bdi_thresh
/ (thresh
+ 1))
639 ctf_integer(unsigned long, bdi_dirty
, bdi_dirty
)
640 ctf_integer(unsigned long, dirty_ratelimit
,
641 KBps(dirty_ratelimit
))
642 ctf_integer(unsigned long, task_ratelimit
,
643 KBps(task_ratelimit
))
644 ctf_integer(unsigned int, dirtied
, dirtied
)
645 ctf_integer(unsigned int, dirtied_pause
,
646 current
->nr_dirtied_pause
)
647 ctf_integer(unsigned long, paused
,
648 (jiffies
- start_time
) * 1000 / HZ
)
649 ctf_integer(long, pause
, pause
* 1000 / HZ
)
650 ctf_integer(unsigned long, period
,
652 ctf_integer(long, think
,
653 current
->dirty_paused_when
== 0 ? 0 :
654 (long)(jiffies
- current
->dirty_paused_when
) * 1000/HZ
)
658 #else /* #if LINUX_VERSION_CODE >= KERNEL_VERSION(4,3,0)) */
660 LTTNG_TRACEPOINT_EVENT_MAP(balance_dirty_pages
,
662 writeback_balance_dirty_pages
,
664 TP_PROTO(struct backing_dev_info
*bdi
,
665 unsigned long thresh
,
666 unsigned long bg_thresh
,
668 unsigned long bdi_thresh
,
669 unsigned long bdi_dirty
,
670 unsigned long dirty_ratelimit
,
671 unsigned long task_ratelimit
,
672 unsigned long dirtied
,
673 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0))
674 unsigned long period
,
677 unsigned long start_time
),
679 TP_ARGS(bdi
, thresh
, bg_thresh
, dirty
, bdi_thresh
, bdi_dirty
,
680 dirty_ratelimit
, task_ratelimit
,
681 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0))
682 dirtied
, period
, pause
, start_time
684 dirtied
, pause
, start_time
689 ctf_array_text(char, bdi
, dev_name(bdi
->dev
), 32)
690 ctf_integer(unsigned long, limit
, global_dirty_limit
)
691 ctf_integer(unsigned long, setpoint
,
692 (global_dirty_limit
+ (thresh
+ bg_thresh
) / 2) / 2)
693 ctf_integer(unsigned long, dirty
, dirty
)
694 ctf_integer(unsigned long, bdi_setpoint
,
695 ((global_dirty_limit
+ (thresh
+ bg_thresh
) / 2) / 2) *
696 bdi_thresh
/ (thresh
+ 1))
697 ctf_integer(unsigned long, bdi_dirty
, bdi_dirty
)
698 ctf_integer(unsigned long, dirty_ratelimit
,
699 KBps(dirty_ratelimit
))
700 ctf_integer(unsigned long, task_ratelimit
,
701 KBps(task_ratelimit
))
702 ctf_integer(unsigned int, dirtied
, dirtied
)
703 ctf_integer(unsigned int, dirtied_pause
,
704 current
->nr_dirtied_pause
)
705 ctf_integer(unsigned long, paused
,
706 (jiffies
- start_time
) * 1000 / HZ
)
707 ctf_integer(long, pause
, pause
* 1000 / HZ
)
708 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0))
709 ctf_integer(unsigned long, period
,
711 ctf_integer(long, think
,
712 current
->dirty_paused_when
== 0 ? 0 :
713 (long)(jiffies
- current
->dirty_paused_when
) * 1000/HZ
)
717 #endif /* #else #if LINUX_VERSION_CODE >= KERNEL_VERSION(4,3,0)) */
719 #endif /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0)) */
721 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0))
722 LTTNG_TRACEPOINT_EVENT(writeback_sb_inodes_requeue
,
724 TP_PROTO(struct inode
*inode
),
728 ctf_array_text(char, name
,
729 dev_name(lttng_inode_to_bdi(inode
)->dev
), 32)
730 ctf_integer(unsigned long, ino
, inode
->i_ino
)
731 ctf_integer(unsigned long, state
, inode
->i_state
)
732 ctf_integer(unsigned long, dirtied_when
, inode
->dirtied_when
)
737 LTTNG_TRACEPOINT_EVENT_CLASS(writeback_congest_waited_template
,
739 TP_PROTO(unsigned int usec_timeout
, unsigned int usec_delayed
),
741 TP_ARGS(usec_timeout
, usec_delayed
),
744 ctf_integer(unsigned int, usec_timeout
, usec_timeout
)
745 ctf_integer(unsigned int, usec_delayed
, usec_delayed
)
749 LTTNG_TRACEPOINT_EVENT_INSTANCE(writeback_congest_waited_template
, writeback_congestion_wait
,
751 TP_PROTO(unsigned int usec_timeout
, unsigned int usec_delayed
),
753 TP_ARGS(usec_timeout
, usec_delayed
)
756 LTTNG_TRACEPOINT_EVENT_INSTANCE(writeback_congest_waited_template
, writeback_wait_iff_congested
,
758 TP_PROTO(unsigned int usec_timeout
, unsigned int usec_delayed
),
760 TP_ARGS(usec_timeout
, usec_delayed
)
763 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0))
764 LTTNG_TRACEPOINT_EVENT_CLASS(writeback_single_inode_template
,
766 TP_PROTO(struct inode
*inode
,
767 struct writeback_control
*wbc
,
768 unsigned long nr_to_write
771 TP_ARGS(inode
, wbc
, nr_to_write
),
774 ctf_array_text(char, name
,
775 dev_name(lttng_inode_to_bdi(inode
)->dev
), 32)
776 ctf_integer(unsigned long, ino
, inode
->i_ino
)
777 ctf_integer(unsigned long, state
, inode
->i_state
)
778 ctf_integer(unsigned long, dirtied_when
, inode
->dirtied_when
)
779 ctf_integer(unsigned long, writeback_index
,
780 inode
->i_mapping
->writeback_index
)
781 ctf_integer(long, nr_to_write
, nr_to_write
)
782 ctf_integer(unsigned long, wrote
,
783 nr_to_write
- wbc
->nr_to_write
)
787 #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0))
788 LTTNG_TRACEPOINT_EVENT_INSTANCE(writeback_single_inode_template
, writeback_single_inode_requeue
,
789 TP_PROTO(struct inode
*inode
,
790 struct writeback_control
*wbc
,
791 unsigned long nr_to_write
),
792 TP_ARGS(inode
, wbc
, nr_to_write
)
796 LTTNG_TRACEPOINT_EVENT_INSTANCE(writeback_single_inode_template
, writeback_single_inode
,
797 TP_PROTO(struct inode
*inode
,
798 struct writeback_control
*wbc
,
799 unsigned long nr_to_write
),
800 TP_ARGS(inode
, wbc
, nr_to_write
)
804 #endif /* LTTNG_TRACE_WRITEBACK_H */
806 /* This part must be outside protection */
807 #include <probes/define_trace.h>