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