Fix: update sched instrumentation for kernel 4.12
[lttng-modules.git] / instrumentation / events / lttng-module / writeback.h
CommitLineData
b87700e3
AG
1#undef TRACE_SYSTEM
2#define TRACE_SYSTEM writeback
3
3bc29f0a
MD
4#if !defined(LTTNG_TRACE_WRITEBACK_H) || defined(TRACE_HEADER_MULTI_READ)
5#define LTTNG_TRACE_WRITEBACK_H
b87700e3 6
6ec43db8 7#include <probes/lttng-tracepoint-event.h>
aa634cd1 8#include <linux/tracepoint.h>
b87700e3
AG
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_
99a570c8 15
cbdd289c
MJ
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))
25static inline struct backing_dev_info *lttng_inode_to_bdi(struct inode *inode)
b87700e3 26{
cbdd289c
MJ
27 struct super_block *sb;
28
29 if (!inode)
30 return &noop_backing_dev_info;
31
32 sb = inode->i_sb;
b87700e3
AG
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}
cbdd289c
MJ
39#else
40static inline struct backing_dev_info *lttng_inode_to_bdi(struct inode *inode)
41{
42 return inode_to_bdi(inode);
43}
99a570c8
MD
44#endif /* #if (LINUX_VERSION_CODE < KERNEL_VERSION(4,0,0)) */
45
b87700e3
AG
46#endif
47
99a570c8
MD
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)) */
b87700e3
AG
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 )
99a570c8 76#endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,0,0)) */
b87700e3 77
99a570c8
MD
78#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,0,0))
79
80LTTNG_TRACEPOINT_EVENT(writeback_dirty_page,
81 TP_PROTO(struct page *page, struct address_space *mapping),
82 TP_ARGS(page, mapping),
f127e61e
MD
83 TP_FIELDS(
84 ctf_array_text(char, name,
cbdd289c 85 mapping ? dev_name(lttng_inode_to_bdi(mapping->host)->dev) : "(unknown)", 32)
f127e61e
MD
86 ctf_integer(unsigned long, ino, mapping ? mapping->host->i_ino : 0)
87 ctf_integer(pgoff_t, index, page->index)
99a570c8
MD
88 )
89)
90
91LTTNG_TRACEPOINT_EVENT_CLASS(writeback_dirty_inode_template,
92 TP_PROTO(struct inode *inode, int flags),
93 TP_ARGS(inode, flags),
f127e61e 94 TP_FIELDS(
99a570c8 95 /* may be called for files on pseudo FSes w/ unregistered bdi */
f127e61e 96 ctf_array_text(char, name,
cbdd289c
MJ
97 lttng_inode_to_bdi(inode)->dev ?
98 dev_name(lttng_inode_to_bdi(inode)->dev) : "(unknown)", 32)
f127e61e
MD
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)
99a570c8
MD
102 )
103)
104#define LTTNG_TRACEPOINT_EVENT_WRITEBACK_DIRTY_INODE_TEMPLATE(name) \
105LTTNG_TRACEPOINT_EVENT_INSTANCE(writeback_dirty_inode_template, name, \
106 TP_PROTO(struct inode *inode, int flags), \
107 TP_ARGS(inode, flags))
108LTTNG_TRACEPOINT_EVENT_WRITEBACK_DIRTY_INODE_TEMPLATE(writeback_dirty_inode_start)
109LTTNG_TRACEPOINT_EVENT_WRITEBACK_DIRTY_INODE_TEMPLATE(writeback_dirty_inode)
110LTTNG_TRACEPOINT_EVENT_WRITEBACK_DIRTY_INODE_TEMPLATE(writeback_mark_inode_dirty)
111
112LTTNG_TRACEPOINT_EVENT_CLASS(writeback_write_inode_template,
113 TP_PROTO(struct inode *inode, struct writeback_control *wbc),
114 TP_ARGS(inode, wbc),
f127e61e
MD
115 TP_FIELDS(
116 ctf_array_text(char, name,
cbdd289c 117 dev_name(lttng_inode_to_bdi(inode)->dev), 32)
f127e61e
MD
118 ctf_integer(unsigned long, ino, inode->i_ino)
119 ctf_integer(int, sync_mode, wbc->sync_mode)
99a570c8
MD
120 )
121)
122
123#define LTTNG_TRACEPOINT_EVENT_WRITEBACK_WRITE_INODE(name) \
124LTTNG_TRACEPOINT_EVENT_INSTANCE(writeback_write_inode_template, name, \
125 TP_PROTO(struct inode *inode, struct writeback_control *wbc), \
126 TP_ARGS(inode, wbc))
127LTTNG_TRACEPOINT_EVENT_WRITEBACK_WRITE_INODE(writeback_write_inode_start)
128LTTNG_TRACEPOINT_EVENT_WRITEBACK_WRITE_INODE(writeback_write_inode)
129
130#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0))
131
aa634cd1
JD
132LTTNG_TRACEPOINT_EVENT(writeback_dirty_page,
133 TP_PROTO(struct page *page, struct address_space *mapping),
134 TP_ARGS(page, mapping),
f127e61e
MD
135 TP_FIELDS(
136 ctf_array_text(char, name,
aa634cd1 137 mapping ? dev_name(mapping->backing_dev_info->dev) : "(unknown)", 32)
f127e61e
MD
138 ctf_integer(unsigned long, ino, mapping ? mapping->host->i_ino : 0)
139 ctf_integer(pgoff_t, index, page->index)
aa634cd1
JD
140 )
141)
142
143LTTNG_TRACEPOINT_EVENT_CLASS(writeback_dirty_inode_template,
144 TP_PROTO(struct inode *inode, int flags),
145 TP_ARGS(inode, flags),
f127e61e 146 TP_FIELDS(
aa634cd1 147 /* may be called for files on pseudo FSes w/ unregistered bdi */
f127e61e 148 ctf_array_text(char, name,
aa634cd1 149 inode->i_mapping->backing_dev_info->dev ?
f127e61e
MD
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)
aa634cd1
JD
154 )
155)
156#define LTTNG_TRACEPOINT_EVENT_WRITEBACK_DIRTY_INODE_TEMPLATE(name) \
157LTTNG_TRACEPOINT_EVENT_INSTANCE(writeback_dirty_inode_template, name, \
158 TP_PROTO(struct inode *inode, int flags), \
159 TP_ARGS(inode, flags))
160LTTNG_TRACEPOINT_EVENT_WRITEBACK_DIRTY_INODE_TEMPLATE(writeback_dirty_inode_start)
161LTTNG_TRACEPOINT_EVENT_WRITEBACK_DIRTY_INODE_TEMPLATE(writeback_dirty_inode)
162
163LTTNG_TRACEPOINT_EVENT_CLASS(writeback_write_inode_template,
164 TP_PROTO(struct inode *inode, struct writeback_control *wbc),
165 TP_ARGS(inode, wbc),
f127e61e
MD
166 TP_FIELDS(
167 ctf_array_text(char, name,
aa634cd1 168 dev_name(inode->i_mapping->backing_dev_info->dev), 32)
f127e61e
MD
169 ctf_integer(unsigned long, ino, inode->i_ino)
170 ctf_integer(int, sync_mode, wbc->sync_mode)
aa634cd1
JD
171 )
172)
173
174#define LTTNG_TRACEPOINT_EVENT_WRITEBACK_WRITE_INODE(name) \
175LTTNG_TRACEPOINT_EVENT_INSTANCE(writeback_write_inode_template, name, \
176 TP_PROTO(struct inode *inode, struct writeback_control *wbc), \
177 TP_ARGS(inode, wbc))
178LTTNG_TRACEPOINT_EVENT_WRITEBACK_WRITE_INODE(writeback_write_inode_start)
179LTTNG_TRACEPOINT_EVENT_WRITEBACK_WRITE_INODE(writeback_write_inode)
99a570c8 180
aa634cd1
JD
181#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0)) */
182
a40cb509
MD
183#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,3,0))
184
185LTTNG_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))
99a570c8
MD
195
196LTTNG_TRACEPOINT_EVENT_CLASS(writeback_work_class,
197 TP_PROTO(struct backing_dev_info *bdi, struct wb_writeback_work *work),
198 TP_ARGS(bdi, work),
f127e61e
MD
199 TP_FIELDS(
200 ctf_array_text(char, name, bdi->dev ? dev_name(bdi->dev) :
99a570c8 201 "(unknown)", 32)
99a570c8
MD
202 )
203)
204
205#else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,0,0)) */
206
3bc29f0a 207LTTNG_TRACEPOINT_EVENT_CLASS(writeback_work_class,
b87700e3
AG
208 TP_PROTO(struct backing_dev_info *bdi, struct wb_writeback_work *work),
209 TP_ARGS(bdi, work),
f127e61e
MD
210 TP_FIELDS(
211 ctf_array_text(char, name,
212 dev_name(bdi->dev ? bdi->dev :
b87700e3 213 default_backing_dev_info.dev), 32)
b87700e3 214 )
b87700e3 215)
99a570c8
MD
216
217#endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,0,0)) */
218
a40cb509
MD
219#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,3,0))
220
221#define LTTNG_TRACEPOINT_EVENT_WRITEBACK_WORK_INSTANCE(name) \
222LTTNG_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
3bc29f0a
MD
228#define LTTNG_TRACEPOINT_EVENT_WRITEBACK_WORK_INSTANCE(name) \
229LTTNG_TRACEPOINT_EVENT_INSTANCE(writeback_work_class, name, \
b87700e3
AG
230 TP_PROTO(struct backing_dev_info *bdi, struct wb_writeback_work *work), \
231 TP_ARGS(bdi, work))
a40cb509
MD
232
233#endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,3,0)) */
234
3bc29f0a
MD
235LTTNG_TRACEPOINT_EVENT_WRITEBACK_WORK_INSTANCE(writeback_nothread)
236LTTNG_TRACEPOINT_EVENT_WRITEBACK_WORK_INSTANCE(writeback_queue)
237LTTNG_TRACEPOINT_EVENT_WRITEBACK_WORK_INSTANCE(writeback_exec)
b87700e3 238#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0))
3bc29f0a
MD
239LTTNG_TRACEPOINT_EVENT_WRITEBACK_WORK_INSTANCE(writeback_start)
240LTTNG_TRACEPOINT_EVENT_WRITEBACK_WORK_INSTANCE(writeback_written)
241LTTNG_TRACEPOINT_EVENT_WRITEBACK_WORK_INSTANCE(writeback_wait)
b87700e3
AG
242#endif
243
3bc29f0a 244LTTNG_TRACEPOINT_EVENT(writeback_pages_written,
b87700e3
AG
245 TP_PROTO(long pages_written),
246 TP_ARGS(pages_written),
f127e61e
MD
247 TP_FIELDS(
248 ctf_integer(long, pages, pages_written)
249 )
b87700e3
AG
250)
251
a40cb509
MD
252#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,3,0))
253
254LTTNG_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) \
265LTTNG_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) \
270LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(writeback_class, name, map, \
271 TP_PROTO(struct bdi_writeback *wb), \
272 TP_ARGS(wb))
273
274LTTNG_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
3bc29f0a 285LTTNG_TRACEPOINT_EVENT_CLASS(writeback_class,
b87700e3
AG
286 TP_PROTO(struct backing_dev_info *bdi),
287 TP_ARGS(bdi),
f127e61e
MD
288 TP_FIELDS(
289 ctf_array_text(char, name,
290 dev_name(bdi->dev), 32)
b87700e3
AG
291 )
292)
a40cb509 293
59fecd6c 294#undef DEFINE_WRITEBACK_EVENT
b87700e3 295#define DEFINE_WRITEBACK_EVENT(name) \
3bc29f0a 296LTTNG_TRACEPOINT_EVENT_INSTANCE(writeback_class, name, \
b87700e3
AG
297 TP_PROTO(struct backing_dev_info *bdi), \
298 TP_ARGS(bdi))
299
9cf29d3e 300#define DEFINE_WRITEBACK_EVENT_MAP(name, map) \
3bc29f0a 301LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(writeback_class, name, map, \
9cf29d3e
MD
302 TP_PROTO(struct backing_dev_info *bdi), \
303 TP_ARGS(bdi))
304
a40cb509
MD
305DEFINE_WRITEBACK_EVENT(writeback_bdi_register)
306
307#endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,3,0)) */
308
b87700e3
AG
309DEFINE_WRITEBACK_EVENT(writeback_nowork)
310#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38))
311DEFINE_WRITEBACK_EVENT(writeback_wake_background)
312#endif
313DEFINE_WRITEBACK_EVENT(writeback_wake_thread)
314DEFINE_WRITEBACK_EVENT(writeback_wake_forker_thread)
b87700e3
AG
315DEFINE_WRITEBACK_EVENT(writeback_bdi_unregister)
316DEFINE_WRITEBACK_EVENT(writeback_thread_start)
317DEFINE_WRITEBACK_EVENT(writeback_thread_stop)
318#if (LTTNG_KERNEL_RANGE(3,1,0, 3,2,0))
9cf29d3e
MD
319DEFINE_WRITEBACK_EVENT_MAP(balance_dirty_start, writeback_balance_dirty_start)
320DEFINE_WRITEBACK_EVENT_MAP(balance_dirty_wait, writeback_balance_dirty_wait)
321
3bc29f0a 322LTTNG_TRACEPOINT_EVENT_MAP(balance_dirty_written,
b87700e3 323
9cf29d3e 324 writeback_balance_dirty_written,
b87700e3
AG
325
326 TP_PROTO(struct backing_dev_info *bdi, int written),
327
328 TP_ARGS(bdi, written),
329
f127e61e
MD
330 TP_FIELDS(
331 ctf_array_text(char, name, dev_name(bdi->dev), 32)
332 ctf_integer(int, written, written)
b87700e3
AG
333 )
334)
335#endif
336
3bc29f0a 337LTTNG_TRACEPOINT_EVENT_CLASS(writeback_wbc_class,
b87700e3
AG
338 TP_PROTO(struct writeback_control *wbc, struct backing_dev_info *bdi),
339 TP_ARGS(wbc, bdi),
f127e61e
MD
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)
b87700e3 349#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,1,0))
f127e61e
MD
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)
b87700e3 353#endif
f127e61e
MD
354 ctf_integer(long, range_start, (long) wbc->range_start)
355 ctf_integer(long, range_end, (long) wbc->range_end)
356 )
b87700e3
AG
357)
358
9cf29d3e 359#undef DEFINE_WBC_EVENT
3bc29f0a
MD
360#define LTTNG_TRACEPOINT_EVENT_WBC_INSTANCE(name, map) \
361LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(writeback_wbc_class, name, map, \
b87700e3
AG
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))
3bc29f0a
MD
365LTTNG_TRACEPOINT_EVENT_WBC_INSTANCE(wbc_writeback_start, writeback_wbc_writeback_start)
366LTTNG_TRACEPOINT_EVENT_WBC_INSTANCE(wbc_writeback_written, writeback_wbc_writeback_written)
367LTTNG_TRACEPOINT_EVENT_WBC_INSTANCE(wbc_writeback_wait, writeback_wbc_writeback_wait)
368LTTNG_TRACEPOINT_EVENT_WBC_INSTANCE(wbc_balance_dirty_start, writeback_wbc_balance_dirty_start)
369LTTNG_TRACEPOINT_EVENT_WBC_INSTANCE(wbc_balance_dirty_written, writeback_wbc_balance_dirty_written)
370LTTNG_TRACEPOINT_EVENT_WBC_INSTANCE(wbc_balance_dirty_wait, writeback_wbc_balance_dirty_wait)
b87700e3 371#endif
3bc29f0a 372LTTNG_TRACEPOINT_EVENT_WBC_INSTANCE(wbc_writepage, writeback_wbc_writepage)
b87700e3
AG
373
374#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0))
3bc29f0a 375LTTNG_TRACEPOINT_EVENT(writeback_queue_io,
b87700e3
AG
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
f127e61e
MD
388 TP_FIELDS(
389 ctf_array_text(char, name, dev_name(wb->bdi->dev), 32)
b87700e3 390#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
b87700e3 391#else
f127e61e
MD
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)
b87700e3 398#endif
f127e61e 399 ctf_integer(int, moved, moved)
b87700e3 400 )
b87700e3
AG
401)
402
3bc29f0a 403LTTNG_TRACEPOINT_EVENT_MAP(global_dirty_state,
9cf29d3e
MD
404
405 writeback_global_dirty_state,
b87700e3
AG
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
f127e61e
MD
415 TP_FIELDS(
416 ctf_integer(unsigned long, nr_dirty, global_page_state(NR_FILE_DIRTY))
417 ctf_integer(unsigned long, nr_writeback, global_page_state(NR_WRITEBACK))
418 ctf_integer(unsigned long, nr_unstable, global_page_state(NR_UNSTABLE_NFS))
419 ctf_integer(unsigned long, nr_dirtied, global_page_state(NR_DIRTIED))
420 ctf_integer(unsigned long, nr_written, global_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)
b87700e3
AG
424 )
425)
426#endif
427
428#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
429
430#define KBps(x) ((x) << (PAGE_SHIFT - 10))
431
a40cb509
MD
432#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,3,0))
433
434LTTNG_TRACEPOINT_EVENT_MAP(bdi_dirty_ratelimit,
435
436 writeback_bdi_dirty_ratelimit,
437
438 TP_PROTO(struct bdi_writeback *wb,
439 unsigned long dirty_rate,
440 unsigned long task_ratelimit),
441
442 TP_ARGS(wb, dirty_rate, task_ratelimit),
443
444 TP_FIELDS(
445 ctf_array_text(char, bdi, dev_name(wb->bdi->dev), 32)
446 ctf_integer(unsigned long, write_bw, KBps(wb->bdi->wb.write_bandwidth))
447 ctf_integer(unsigned long, avg_write_bw, KBps(wb->bdi->wb.avg_write_bandwidth))
448 ctf_integer(unsigned long, dirty_rate, KBps(dirty_rate))
449 ctf_integer(unsigned long, dirty_ratelimit, KBps(wb->bdi->wb.dirty_ratelimit))
450 ctf_integer(unsigned long, task_ratelimit, KBps(task_ratelimit))
451 ctf_integer(unsigned long, balanced_dirty_ratelimit,
452 KBps(wb->bdi->wb.balanced_dirty_ratelimit))
453 )
454)
455
456#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,2,0))
c7d89a6d 457
3bc29f0a 458LTTNG_TRACEPOINT_EVENT_MAP(bdi_dirty_ratelimit,
9cf29d3e
MD
459
460 writeback_bdi_dirty_ratelimit,
b87700e3
AG
461
462 TP_PROTO(struct backing_dev_info *bdi,
463 unsigned long dirty_rate,
464 unsigned long task_ratelimit),
465
466 TP_ARGS(bdi, dirty_rate, task_ratelimit),
467
f127e61e
MD
468 TP_FIELDS(
469 ctf_array_text(char, bdi, dev_name(bdi->dev), 32)
902947a4
MJ
470 ctf_integer(unsigned long, write_bw, KBps(bdi->wb.write_bandwidth))
471 ctf_integer(unsigned long, avg_write_bw, KBps(bdi->wb.avg_write_bandwidth))
f127e61e 472 ctf_integer(unsigned long, dirty_rate, KBps(dirty_rate))
902947a4 473 ctf_integer(unsigned long, dirty_ratelimit, KBps(bdi->wb.dirty_ratelimit))
f127e61e 474 ctf_integer(unsigned long, task_ratelimit, KBps(task_ratelimit))
902947a4
MJ
475 ctf_integer(unsigned long, balanced_dirty_ratelimit,
476 KBps(bdi->wb.balanced_dirty_ratelimit))
c7d89a6d
MD
477 )
478)
479
480#else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,2,0)) */
481
482LTTNG_TRACEPOINT_EVENT_MAP(bdi_dirty_ratelimit,
483
484 writeback_bdi_dirty_ratelimit,
485
486 TP_PROTO(struct backing_dev_info *bdi,
487 unsigned long dirty_rate,
488 unsigned long task_ratelimit),
489
490 TP_ARGS(bdi, dirty_rate, task_ratelimit),
491
492 TP_FIELDS(
493 ctf_array_text(char, bdi, dev_name(bdi->dev), 32)
494 ctf_integer(unsigned long, write_bw, KBps(bdi->write_bandwidth))
495 ctf_integer(unsigned long, avg_write_bw, KBps(bdi->avg_write_bandwidth))
496 ctf_integer(unsigned long, dirty_rate, KBps(dirty_rate))
497 ctf_integer(unsigned long, dirty_ratelimit, KBps(bdi->dirty_ratelimit))
498 ctf_integer(unsigned long, task_ratelimit, KBps(task_ratelimit))
f127e61e 499 ctf_integer(unsigned long, balanced_dirty_ratelimit,
b87700e3 500 KBps(bdi->balanced_dirty_ratelimit))
b87700e3
AG
501 )
502)
503
c7d89a6d
MD
504#endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,2,0)) */
505
a40cb509
MD
506#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,3,0))
507
508LTTNG_TRACEPOINT_EVENT_MAP(balance_dirty_pages,
509
510 writeback_balance_dirty_pages,
511
512 TP_PROTO(struct bdi_writeback *wb,
513 unsigned long thresh,
514 unsigned long bg_thresh,
515 unsigned long dirty,
516 unsigned long bdi_thresh,
517 unsigned long bdi_dirty,
518 unsigned long dirty_ratelimit,
519 unsigned long task_ratelimit,
520 unsigned long dirtied,
521 unsigned long period,
522 long pause,
523 unsigned long start_time),
524
525 TP_ARGS(wb, thresh, bg_thresh, dirty, bdi_thresh, bdi_dirty,
526 dirty_ratelimit, task_ratelimit,
527 dirtied, period, pause, start_time
528 ),
529
530 TP_FIELDS(
531 ctf_array_text(char, bdi, dev_name(wb->bdi->dev), 32)
532 ctf_integer(unsigned long, limit, global_dirty_limit)
533 ctf_integer(unsigned long, setpoint,
534 (global_dirty_limit + (thresh + bg_thresh) / 2) / 2)
535 ctf_integer(unsigned long, dirty, dirty)
536 ctf_integer(unsigned long, bdi_setpoint,
537 ((global_dirty_limit + (thresh + bg_thresh) / 2) / 2) *
538 bdi_thresh / (thresh + 1))
539 ctf_integer(unsigned long, bdi_dirty, bdi_dirty)
540 ctf_integer(unsigned long, dirty_ratelimit,
541 KBps(dirty_ratelimit))
542 ctf_integer(unsigned long, task_ratelimit,
543 KBps(task_ratelimit))
544 ctf_integer(unsigned int, dirtied, dirtied)
545 ctf_integer(unsigned int, dirtied_pause,
546 current->nr_dirtied_pause)
547 ctf_integer(unsigned long, paused,
548 (jiffies - start_time) * 1000 / HZ)
549 ctf_integer(long, pause, pause * 1000 / HZ)
550 ctf_integer(unsigned long, period,
551 period * 1000 / HZ)
552 ctf_integer(long, think,
553 current->dirty_paused_when == 0 ? 0 :
554 (long)(jiffies - current->dirty_paused_when) * 1000/HZ)
555 )
556)
557
558#else /* #if LINUX_VERSION_CODE >= KERNEL_VERSION(4,3,0)) */
559
3bc29f0a 560LTTNG_TRACEPOINT_EVENT_MAP(balance_dirty_pages,
9cf29d3e
MD
561
562 writeback_balance_dirty_pages,
b87700e3
AG
563
564 TP_PROTO(struct backing_dev_info *bdi,
565 unsigned long thresh,
566 unsigned long bg_thresh,
567 unsigned long dirty,
568 unsigned long bdi_thresh,
569 unsigned long bdi_dirty,
570 unsigned long dirty_ratelimit,
571 unsigned long task_ratelimit,
572 unsigned long dirtied,
573#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0))
574 unsigned long period,
575#endif
576 long pause,
577 unsigned long start_time),
578
579 TP_ARGS(bdi, thresh, bg_thresh, dirty, bdi_thresh, bdi_dirty,
580 dirty_ratelimit, task_ratelimit,
581#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0))
f127e61e 582 dirtied, period, pause, start_time
b87700e3 583#else
f127e61e 584 dirtied, pause, start_time
b87700e3
AG
585#endif
586 ),
587
f127e61e
MD
588 TP_FIELDS(
589 ctf_array_text(char, bdi, dev_name(bdi->dev), 32)
590 ctf_integer(unsigned long, limit, global_dirty_limit)
591 ctf_integer(unsigned long, setpoint,
b87700e3 592 (global_dirty_limit + (thresh + bg_thresh) / 2) / 2)
f127e61e
MD
593 ctf_integer(unsigned long, dirty, dirty)
594 ctf_integer(unsigned long, bdi_setpoint,
b87700e3 595 ((global_dirty_limit + (thresh + bg_thresh) / 2) / 2) *
f127e61e
MD
596 bdi_thresh / (thresh + 1))
597 ctf_integer(unsigned long, bdi_dirty, bdi_dirty)
598 ctf_integer(unsigned long, dirty_ratelimit,
599 KBps(dirty_ratelimit))
600 ctf_integer(unsigned long, task_ratelimit,
601 KBps(task_ratelimit))
602 ctf_integer(unsigned int, dirtied, dirtied)
603 ctf_integer(unsigned int, dirtied_pause,
604 current->nr_dirtied_pause)
605 ctf_integer(unsigned long, paused,
606 (jiffies - start_time) * 1000 / HZ)
607 ctf_integer(long, pause, pause * 1000 / HZ)
b87700e3 608#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0))
f127e61e
MD
609 ctf_integer(unsigned long, period,
610 period * 1000 / HZ)
611 ctf_integer(long, think,
612 current->dirty_paused_when == 0 ? 0 :
613 (long)(jiffies - current->dirty_paused_when) * 1000/HZ)
b87700e3 614#endif
f127e61e 615 )
b87700e3 616)
a40cb509
MD
617#endif /* #else #if LINUX_VERSION_CODE >= KERNEL_VERSION(4,3,0)) */
618
619#endif /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0)) */
b87700e3
AG
620
621#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0))
3bc29f0a 622LTTNG_TRACEPOINT_EVENT(writeback_sb_inodes_requeue,
b87700e3
AG
623
624 TP_PROTO(struct inode *inode),
625 TP_ARGS(inode),
626
f127e61e
MD
627 TP_FIELDS(
628 ctf_array_text(char, name,
cbdd289c 629 dev_name(lttng_inode_to_bdi(inode)->dev), 32)
f127e61e
MD
630 ctf_integer(unsigned long, ino, inode->i_ino)
631 ctf_integer(unsigned long, state, inode->i_state)
632 ctf_integer(unsigned long, dirtied_when, inode->dirtied_when)
b87700e3
AG
633 )
634)
635#endif
636
637#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37))
3bc29f0a 638LTTNG_TRACEPOINT_EVENT_CLASS(writeback_congest_waited_template,
b87700e3
AG
639
640 TP_PROTO(unsigned int usec_timeout, unsigned int usec_delayed),
641
642 TP_ARGS(usec_timeout, usec_delayed),
643
f127e61e
MD
644 TP_FIELDS(
645 ctf_integer(unsigned int, usec_timeout, usec_timeout)
646 ctf_integer(unsigned int, usec_delayed, usec_delayed)
647 )
b87700e3
AG
648)
649
3bc29f0a 650LTTNG_TRACEPOINT_EVENT_INSTANCE(writeback_congest_waited_template, writeback_congestion_wait,
b87700e3
AG
651
652 TP_PROTO(unsigned int usec_timeout, unsigned int usec_delayed),
653
654 TP_ARGS(usec_timeout, usec_delayed)
655)
656
3bc29f0a 657LTTNG_TRACEPOINT_EVENT_INSTANCE(writeback_congest_waited_template, writeback_wait_iff_congested,
b87700e3
AG
658
659 TP_PROTO(unsigned int usec_timeout, unsigned int usec_delayed),
660
661 TP_ARGS(usec_timeout, usec_delayed)
662)
663#endif
664
665#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0))
3bc29f0a 666LTTNG_TRACEPOINT_EVENT_CLASS(writeback_single_inode_template,
b87700e3
AG
667
668 TP_PROTO(struct inode *inode,
669 struct writeback_control *wbc,
670 unsigned long nr_to_write
671 ),
672
673 TP_ARGS(inode, wbc, nr_to_write),
674
f127e61e
MD
675 TP_FIELDS(
676 ctf_array_text(char, name,
cbdd289c 677 dev_name(lttng_inode_to_bdi(inode)->dev), 32)
f127e61e
MD
678 ctf_integer(unsigned long, ino, inode->i_ino)
679 ctf_integer(unsigned long, state, inode->i_state)
680 ctf_integer(unsigned long, dirtied_when, inode->dirtied_when)
681 ctf_integer(unsigned long, writeback_index,
682 inode->i_mapping->writeback_index)
683 ctf_integer(long, nr_to_write, nr_to_write)
684 ctf_integer(unsigned long, wrote,
685 nr_to_write - wbc->nr_to_write)
b87700e3
AG
686 )
687)
688
689#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0))
3bc29f0a 690LTTNG_TRACEPOINT_EVENT_INSTANCE(writeback_single_inode_template, writeback_single_inode_requeue,
b87700e3
AG
691 TP_PROTO(struct inode *inode,
692 struct writeback_control *wbc,
693 unsigned long nr_to_write),
694 TP_ARGS(inode, wbc, nr_to_write)
695)
696#endif
697
3bc29f0a 698LTTNG_TRACEPOINT_EVENT_INSTANCE(writeback_single_inode_template, writeback_single_inode,
b87700e3
AG
699 TP_PROTO(struct inode *inode,
700 struct writeback_control *wbc,
701 unsigned long nr_to_write),
702 TP_ARGS(inode, wbc, nr_to_write)
703)
704#endif
705
3bc29f0a 706#endif /* LTTNG_TRACE_WRITEBACK_H */
b87700e3
AG
707
708/* This part must be outside protection */
6ec43db8 709#include <probes/define_trace.h>
This page took 0.061204 seconds and 4 git commands to generate.