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