| 1 | // SPDX-FileCopyrightText: 2012 Andrew Gabbasov <andrew_gabbasov@mentor.com> |
| 2 | // |
| 3 | // SPDX-License-Identifier: GPL-2.0-only |
| 4 | |
| 5 | #undef TRACE_SYSTEM |
| 6 | #define TRACE_SYSTEM writeback |
| 7 | |
| 8 | #if !defined(LTTNG_TRACE_WRITEBACK_H) || defined(TRACE_HEADER_MULTI_READ) |
| 9 | #define LTTNG_TRACE_WRITEBACK_H |
| 10 | |
| 11 | #include <lttng/tracepoint-event.h> |
| 12 | #include <linux/tracepoint.h> |
| 13 | #include <linux/backing-dev.h> |
| 14 | #include <linux/writeback.h> |
| 15 | #include <lttng/kernel-version.h> |
| 16 | |
| 17 | #ifndef _TRACE_WRITEBACK_DEF_ |
| 18 | #define _TRACE_WRITEBACK_DEF_ |
| 19 | |
| 20 | /* |
| 21 | * Use the GPL-exported bdi_dev_name introduced in kernel 5.7. Do not use |
| 22 | * static inline bdi_dev_name in prior kernels because it uses the bdi_unknown_name |
| 23 | * symbol which is not exported to GPL modules. |
| 24 | */ |
| 25 | #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,7,0)) |
| 26 | static inline const char *lttng_bdi_dev_name(struct backing_dev_info *bdi) |
| 27 | { |
| 28 | return bdi_dev_name(bdi); |
| 29 | } |
| 30 | #else |
| 31 | static inline const char *lttng_bdi_dev_name(struct backing_dev_info *bdi) |
| 32 | { |
| 33 | if (!bdi || !bdi->dev) |
| 34 | return "(unknown)"; |
| 35 | return dev_name(bdi->dev); |
| 36 | } |
| 37 | #endif |
| 38 | #endif |
| 39 | |
| 40 | /* |
| 41 | * Keep this macro around to track changes in the valid values for `state`. |
| 42 | * Eventually, we will have a enum to describe that field. If the macro is |
| 43 | * changed by an upstream kernel, the fact that we have a redefinition here |
| 44 | * will generate a compiler warning. |
| 45 | */ |
| 46 | #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,9,0) || \ |
| 47 | LTTNG_KERNEL_RANGE(4,14,218, 4,15,0) || \ |
| 48 | LTTNG_KERNEL_RANGE(4,19,172, 4,20,0) || \ |
| 49 | LTTNG_KERNEL_RANGE(5,4,94, 5,5,0) || \ |
| 50 | LTTNG_UBUNTU_KERNEL_RANGE(4,15,18,141, 4,16,0,0) || \ |
| 51 | LTTNG_RHEL_KERNEL_RANGE(4,18,0,240,0,0, 4,19,0,0,0,0)) |
| 52 | #define show_inode_state(state) \ |
| 53 | __print_flags(state, "|", \ |
| 54 | {I_DIRTY_SYNC, "I_DIRTY_SYNC"}, \ |
| 55 | {I_DIRTY_DATASYNC, "I_DIRTY_DATASYNC"}, \ |
| 56 | {I_DIRTY_PAGES, "I_DIRTY_PAGES"}, \ |
| 57 | {I_NEW, "I_NEW"}, \ |
| 58 | {I_WILL_FREE, "I_WILL_FREE"}, \ |
| 59 | {I_FREEING, "I_FREEING"}, \ |
| 60 | {I_CLEAR, "I_CLEAR"}, \ |
| 61 | {I_SYNC, "I_SYNC"}, \ |
| 62 | {I_DIRTY_TIME, "I_DIRTY_TIME"}, \ |
| 63 | {I_REFERENCED, "I_REFERENCED"} \ |
| 64 | ) |
| 65 | #else |
| 66 | #define show_inode_state(state) \ |
| 67 | __print_flags(state, "|", \ |
| 68 | {I_DIRTY_SYNC, "I_DIRTY_SYNC"}, \ |
| 69 | {I_DIRTY_DATASYNC, "I_DIRTY_DATASYNC"}, \ |
| 70 | {I_DIRTY_PAGES, "I_DIRTY_PAGES"}, \ |
| 71 | {I_NEW, "I_NEW"}, \ |
| 72 | {I_WILL_FREE, "I_WILL_FREE"}, \ |
| 73 | {I_FREEING, "I_FREEING"}, \ |
| 74 | {I_CLEAR, "I_CLEAR"}, \ |
| 75 | {I_SYNC, "I_SYNC"}, \ |
| 76 | {I_DIRTY_TIME, "I_DIRTY_TIME"}, \ |
| 77 | {I_DIRTY_TIME_EXPIRED, "I_DIRTY_TIME_EXPIRED"}, \ |
| 78 | {I_REFERENCED, "I_REFERENCED"} \ |
| 79 | ) |
| 80 | #endif /* #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,9,0)) */ |
| 81 | |
| 82 | LTTNG_TRACEPOINT_EVENT(writeback_dirty_page, |
| 83 | TP_PROTO(struct page *page, struct address_space *mapping), |
| 84 | TP_ARGS(page, mapping), |
| 85 | TP_FIELDS( |
| 86 | ctf_string(name, lttng_bdi_dev_name(mapping ? inode_to_bdi(mapping->host) : NULL)) |
| 87 | ctf_integer(unsigned long, ino, mapping ? mapping->host->i_ino : 0) |
| 88 | ctf_integer(pgoff_t, index, page->index) |
| 89 | ) |
| 90 | ) |
| 91 | |
| 92 | LTTNG_TRACEPOINT_EVENT_CLASS(writeback_dirty_inode_template, |
| 93 | TP_PROTO(struct inode *inode, int flags), |
| 94 | TP_ARGS(inode, flags), |
| 95 | TP_FIELDS( |
| 96 | /* may be called for files on pseudo FSes w/ unregistered bdi */ |
| 97 | ctf_string(name, lttng_bdi_dev_name(inode_to_bdi(inode))) |
| 98 | ctf_integer(unsigned long, ino, inode->i_ino) |
| 99 | ctf_integer(unsigned long, state, inode->i_state) |
| 100 | ctf_integer(unsigned long, flags, flags) |
| 101 | ) |
| 102 | ) |
| 103 | #define LTTNG_TRACEPOINT_EVENT_WRITEBACK_DIRTY_INODE_TEMPLATE(name) \ |
| 104 | LTTNG_TRACEPOINT_EVENT_INSTANCE(writeback_dirty_inode_template, name, \ |
| 105 | TP_PROTO(struct inode *inode, int flags), \ |
| 106 | TP_ARGS(inode, flags)) |
| 107 | LTTNG_TRACEPOINT_EVENT_WRITEBACK_DIRTY_INODE_TEMPLATE(writeback_dirty_inode_start) |
| 108 | LTTNG_TRACEPOINT_EVENT_WRITEBACK_DIRTY_INODE_TEMPLATE(writeback_dirty_inode) |
| 109 | LTTNG_TRACEPOINT_EVENT_WRITEBACK_DIRTY_INODE_TEMPLATE(writeback_mark_inode_dirty) |
| 110 | |
| 111 | LTTNG_TRACEPOINT_EVENT_CLASS(writeback_write_inode_template, |
| 112 | TP_PROTO(struct inode *inode, struct writeback_control *wbc), |
| 113 | TP_ARGS(inode, wbc), |
| 114 | TP_FIELDS( |
| 115 | ctf_string(name, lttng_bdi_dev_name(inode_to_bdi(inode))) |
| 116 | ctf_integer(unsigned long, ino, inode->i_ino) |
| 117 | ctf_integer(int, sync_mode, wbc->sync_mode) |
| 118 | ) |
| 119 | ) |
| 120 | |
| 121 | #define LTTNG_TRACEPOINT_EVENT_WRITEBACK_WRITE_INODE(name) \ |
| 122 | LTTNG_TRACEPOINT_EVENT_INSTANCE(writeback_write_inode_template, name, \ |
| 123 | TP_PROTO(struct inode *inode, struct writeback_control *wbc), \ |
| 124 | TP_ARGS(inode, wbc)) |
| 125 | LTTNG_TRACEPOINT_EVENT_WRITEBACK_WRITE_INODE(writeback_write_inode_start) |
| 126 | LTTNG_TRACEPOINT_EVENT_WRITEBACK_WRITE_INODE(writeback_write_inode) |
| 127 | |
| 128 | |
| 129 | LTTNG_TRACEPOINT_EVENT_CLASS(writeback_work_class, |
| 130 | TP_PROTO(struct bdi_writeback *wb, struct wb_writeback_work *work), |
| 131 | TP_ARGS(wb, work), |
| 132 | TP_FIELDS( |
| 133 | ctf_string(name, lttng_bdi_dev_name(wb->bdi)) |
| 134 | ) |
| 135 | ) |
| 136 | |
| 137 | #define LTTNG_TRACEPOINT_EVENT_WRITEBACK_WORK_INSTANCE(name) \ |
| 138 | LTTNG_TRACEPOINT_EVENT_INSTANCE(writeback_work_class, name, \ |
| 139 | TP_PROTO(struct bdi_writeback *wb, struct wb_writeback_work *work), \ |
| 140 | TP_ARGS(wb, work)) |
| 141 | |
| 142 | LTTNG_TRACEPOINT_EVENT_WRITEBACK_WORK_INSTANCE(writeback_nothread) |
| 143 | LTTNG_TRACEPOINT_EVENT_WRITEBACK_WORK_INSTANCE(writeback_queue) |
| 144 | LTTNG_TRACEPOINT_EVENT_WRITEBACK_WORK_INSTANCE(writeback_exec) |
| 145 | LTTNG_TRACEPOINT_EVENT_WRITEBACK_WORK_INSTANCE(writeback_start) |
| 146 | LTTNG_TRACEPOINT_EVENT_WRITEBACK_WORK_INSTANCE(writeback_written) |
| 147 | LTTNG_TRACEPOINT_EVENT_WRITEBACK_WORK_INSTANCE(writeback_wait) |
| 148 | |
| 149 | LTTNG_TRACEPOINT_EVENT(writeback_pages_written, |
| 150 | TP_PROTO(long pages_written), |
| 151 | TP_ARGS(pages_written), |
| 152 | TP_FIELDS( |
| 153 | ctf_integer(long, pages, pages_written) |
| 154 | ) |
| 155 | ) |
| 156 | |
| 157 | LTTNG_TRACEPOINT_EVENT_CLASS(writeback_class, |
| 158 | TP_PROTO(struct bdi_writeback *wb), |
| 159 | TP_ARGS(wb), |
| 160 | TP_FIELDS( |
| 161 | ctf_string(name, lttng_bdi_dev_name(wb->bdi)) |
| 162 | ) |
| 163 | ) |
| 164 | |
| 165 | #undef DEFINE_WRITEBACK_EVENT |
| 166 | #define DEFINE_WRITEBACK_EVENT(name) \ |
| 167 | LTTNG_TRACEPOINT_EVENT_INSTANCE(writeback_class, name, \ |
| 168 | TP_PROTO(struct bdi_writeback *wb), \ |
| 169 | TP_ARGS(wb)) |
| 170 | |
| 171 | #define DEFINE_WRITEBACK_EVENT_MAP(name, map) \ |
| 172 | LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(writeback_class, name, map, \ |
| 173 | TP_PROTO(struct bdi_writeback *wb), \ |
| 174 | TP_ARGS(wb)) |
| 175 | |
| 176 | LTTNG_TRACEPOINT_EVENT(writeback_bdi_register, |
| 177 | TP_PROTO(struct backing_dev_info *bdi), |
| 178 | TP_ARGS(bdi), |
| 179 | TP_FIELDS( |
| 180 | ctf_string(name, lttng_bdi_dev_name(bdi)) |
| 181 | ) |
| 182 | ) |
| 183 | |
| 184 | DEFINE_WRITEBACK_EVENT(writeback_nowork) |
| 185 | DEFINE_WRITEBACK_EVENT(writeback_wake_background) |
| 186 | DEFINE_WRITEBACK_EVENT(writeback_wake_thread) |
| 187 | DEFINE_WRITEBACK_EVENT(writeback_wake_forker_thread) |
| 188 | DEFINE_WRITEBACK_EVENT(writeback_bdi_unregister) |
| 189 | DEFINE_WRITEBACK_EVENT(writeback_thread_start) |
| 190 | DEFINE_WRITEBACK_EVENT(writeback_thread_stop) |
| 191 | |
| 192 | LTTNG_TRACEPOINT_EVENT_CLASS(writeback_wbc_class, |
| 193 | TP_PROTO(struct writeback_control *wbc, struct backing_dev_info *bdi), |
| 194 | TP_ARGS(wbc, bdi), |
| 195 | TP_FIELDS( |
| 196 | ctf_string(name, lttng_bdi_dev_name(bdi)) |
| 197 | ctf_integer(long, nr_to_write, wbc->nr_to_write) |
| 198 | ctf_integer(long, pages_skipped, wbc->pages_skipped) |
| 199 | ctf_integer(int, sync_mode, wbc->sync_mode) |
| 200 | ctf_integer(int, for_kupdate, wbc->for_kupdate) |
| 201 | ctf_integer(int, for_background, wbc->for_background) |
| 202 | ctf_integer(int, for_reclaim, wbc->for_reclaim) |
| 203 | ctf_integer(int, range_cyclic, wbc->range_cyclic) |
| 204 | ctf_integer(long, range_start, (long) wbc->range_start) |
| 205 | ctf_integer(long, range_end, (long) wbc->range_end) |
| 206 | ) |
| 207 | ) |
| 208 | |
| 209 | #undef DEFINE_WBC_EVENT |
| 210 | #define LTTNG_TRACEPOINT_EVENT_WBC_INSTANCE(name, map) \ |
| 211 | LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(writeback_wbc_class, name, map, \ |
| 212 | TP_PROTO(struct writeback_control *wbc, struct backing_dev_info *bdi), \ |
| 213 | TP_ARGS(wbc, bdi)) |
| 214 | LTTNG_TRACEPOINT_EVENT_WBC_INSTANCE(wbc_writepage, writeback_wbc_writepage) |
| 215 | |
| 216 | #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,9,0) || \ |
| 217 | LTTNG_KERNEL_RANGE(5,8,6, 5,9,0) || \ |
| 218 | LTTNG_KERNEL_RANGE(5,4,62, 5,5,0) || \ |
| 219 | LTTNG_KERNEL_RANGE(4,19,143, 4,20,0) || \ |
| 220 | LTTNG_KERNEL_RANGE(4,14,196, 4,15,0) || \ |
| 221 | LTTNG_KERNEL_RANGE(4,9,235, 4,10,0) || \ |
| 222 | LTTNG_KERNEL_RANGE(4,4,235, 4,5,0) || \ |
| 223 | LTTNG_UBUNTU_KERNEL_RANGE(4,15,18,119, 4,16,0,0) || \ |
| 224 | LTTNG_RHEL_KERNEL_RANGE(4,18,0,240,0,0, 4,19,0,0,0,0)) |
| 225 | LTTNG_TRACEPOINT_EVENT(writeback_queue_io, |
| 226 | TP_PROTO(struct bdi_writeback *wb, |
| 227 | struct wb_writeback_work *work, |
| 228 | unsigned long dirtied_before, |
| 229 | int moved), |
| 230 | TP_ARGS(wb, work, dirtied_before, moved), |
| 231 | TP_FIELDS( |
| 232 | ctf_string(name, lttng_bdi_dev_name(wb->bdi)) |
| 233 | ctf_integer(unsigned long, older, dirtied_before) |
| 234 | ctf_integer(int, moved, moved) |
| 235 | ) |
| 236 | ) |
| 237 | #else |
| 238 | LTTNG_TRACEPOINT_EVENT(writeback_queue_io, |
| 239 | TP_PROTO(struct bdi_writeback *wb, |
| 240 | struct wb_writeback_work *work, |
| 241 | int moved), |
| 242 | TP_ARGS(wb, work, moved), |
| 243 | TP_FIELDS( |
| 244 | ctf_string(name, lttng_bdi_dev_name(wb->bdi)) |
| 245 | ctf_integer(int, moved, moved) |
| 246 | ) |
| 247 | ) |
| 248 | #endif |
| 249 | |
| 250 | #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,8,0) || \ |
| 251 | LTTNG_RHEL_KERNEL_RANGE(4,18,0,305,0,0, 4,19,0,0,0,0)) |
| 252 | LTTNG_TRACEPOINT_EVENT_MAP(global_dirty_state, |
| 253 | |
| 254 | writeback_global_dirty_state, |
| 255 | |
| 256 | TP_PROTO(unsigned long background_thresh, |
| 257 | unsigned long dirty_thresh |
| 258 | ), |
| 259 | |
| 260 | TP_ARGS(background_thresh, |
| 261 | dirty_thresh |
| 262 | ), |
| 263 | |
| 264 | TP_FIELDS( |
| 265 | ctf_integer(unsigned long, nr_dirty, global_node_page_state(NR_FILE_DIRTY)) |
| 266 | ctf_integer(unsigned long, nr_writeback, global_node_page_state(NR_WRITEBACK)) |
| 267 | ctf_integer(unsigned long, nr_dirtied, global_node_page_state(NR_DIRTIED)) |
| 268 | ctf_integer(unsigned long, nr_written, global_node_page_state(NR_WRITTEN)) |
| 269 | ctf_integer(unsigned long, background_thresh, background_thresh) |
| 270 | ctf_integer(unsigned long, dirty_thresh, dirty_thresh) |
| 271 | ctf_integer(unsigned long, dirty_limit, global_dirty_limit) |
| 272 | ) |
| 273 | ) |
| 274 | #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,14,0)) |
| 275 | LTTNG_TRACEPOINT_EVENT_MAP(global_dirty_state, |
| 276 | |
| 277 | writeback_global_dirty_state, |
| 278 | |
| 279 | TP_PROTO(unsigned long background_thresh, |
| 280 | unsigned long dirty_thresh |
| 281 | ), |
| 282 | |
| 283 | TP_ARGS(background_thresh, |
| 284 | dirty_thresh |
| 285 | ), |
| 286 | |
| 287 | TP_FIELDS( |
| 288 | ctf_integer(unsigned long, nr_dirty, global_node_page_state(NR_FILE_DIRTY)) |
| 289 | ctf_integer(unsigned long, nr_writeback, global_node_page_state(NR_WRITEBACK)) |
| 290 | ctf_integer(unsigned long, nr_unstable, global_node_page_state(NR_UNSTABLE_NFS)) |
| 291 | ctf_integer(unsigned long, nr_dirtied, global_node_page_state(NR_DIRTIED)) |
| 292 | ctf_integer(unsigned long, nr_written, global_node_page_state(NR_WRITTEN)) |
| 293 | ctf_integer(unsigned long, background_thresh, background_thresh) |
| 294 | ctf_integer(unsigned long, dirty_thresh, dirty_thresh) |
| 295 | ctf_integer(unsigned long, dirty_limit, global_dirty_limit) |
| 296 | ) |
| 297 | ) |
| 298 | #else |
| 299 | LTTNG_TRACEPOINT_EVENT_MAP(global_dirty_state, |
| 300 | |
| 301 | writeback_global_dirty_state, |
| 302 | |
| 303 | TP_PROTO(unsigned long background_thresh, |
| 304 | unsigned long dirty_thresh |
| 305 | ), |
| 306 | |
| 307 | TP_ARGS(background_thresh, |
| 308 | dirty_thresh |
| 309 | ), |
| 310 | |
| 311 | TP_FIELDS( |
| 312 | ctf_integer(unsigned long, nr_dirty, global_page_state(NR_FILE_DIRTY)) |
| 313 | ctf_integer(unsigned long, nr_writeback, global_page_state(NR_WRITEBACK)) |
| 314 | ctf_integer(unsigned long, nr_unstable, global_page_state(NR_UNSTABLE_NFS)) |
| 315 | ctf_integer(unsigned long, nr_dirtied, global_page_state(NR_DIRTIED)) |
| 316 | ctf_integer(unsigned long, nr_written, global_page_state(NR_WRITTEN)) |
| 317 | ctf_integer(unsigned long, background_thresh, background_thresh) |
| 318 | ctf_integer(unsigned long, dirty_thresh, dirty_thresh) |
| 319 | ctf_integer(unsigned long, dirty_limit, global_dirty_limit) |
| 320 | ) |
| 321 | ) |
| 322 | #endif |
| 323 | |
| 324 | #define KBps(x) ((x) << (PAGE_SHIFT - 10)) |
| 325 | |
| 326 | LTTNG_TRACEPOINT_EVENT_MAP(bdi_dirty_ratelimit, |
| 327 | |
| 328 | writeback_bdi_dirty_ratelimit, |
| 329 | |
| 330 | TP_PROTO(struct bdi_writeback *wb, |
| 331 | unsigned long dirty_rate, |
| 332 | unsigned long task_ratelimit), |
| 333 | |
| 334 | TP_ARGS(wb, dirty_rate, task_ratelimit), |
| 335 | |
| 336 | TP_FIELDS( |
| 337 | ctf_string(bdi, lttng_bdi_dev_name(wb->bdi)) |
| 338 | ctf_integer(unsigned long, write_bw, KBps(wb->bdi->wb.write_bandwidth)) |
| 339 | ctf_integer(unsigned long, avg_write_bw, KBps(wb->bdi->wb.avg_write_bandwidth)) |
| 340 | ctf_integer(unsigned long, dirty_rate, KBps(dirty_rate)) |
| 341 | ctf_integer(unsigned long, dirty_ratelimit, KBps(wb->bdi->wb.dirty_ratelimit)) |
| 342 | ctf_integer(unsigned long, task_ratelimit, KBps(task_ratelimit)) |
| 343 | ctf_integer(unsigned long, balanced_dirty_ratelimit, |
| 344 | KBps(wb->bdi->wb.balanced_dirty_ratelimit)) |
| 345 | ) |
| 346 | ) |
| 347 | |
| 348 | LTTNG_TRACEPOINT_EVENT_MAP(balance_dirty_pages, |
| 349 | |
| 350 | writeback_balance_dirty_pages, |
| 351 | |
| 352 | TP_PROTO(struct bdi_writeback *wb, |
| 353 | unsigned long thresh, |
| 354 | unsigned long bg_thresh, |
| 355 | unsigned long dirty, |
| 356 | unsigned long bdi_thresh, |
| 357 | unsigned long bdi_dirty, |
| 358 | unsigned long dirty_ratelimit, |
| 359 | unsigned long task_ratelimit, |
| 360 | unsigned long dirtied, |
| 361 | unsigned long period, |
| 362 | long pause, |
| 363 | unsigned long start_time), |
| 364 | |
| 365 | TP_ARGS(wb, thresh, bg_thresh, dirty, bdi_thresh, bdi_dirty, |
| 366 | dirty_ratelimit, task_ratelimit, |
| 367 | dirtied, period, pause, start_time |
| 368 | ), |
| 369 | |
| 370 | TP_FIELDS( |
| 371 | ctf_string(bdi, lttng_bdi_dev_name(wb->bdi)) |
| 372 | ctf_integer(unsigned long, limit, global_dirty_limit) |
| 373 | ctf_integer(unsigned long, setpoint, |
| 374 | (global_dirty_limit + (thresh + bg_thresh) / 2) / 2) |
| 375 | ctf_integer(unsigned long, dirty, dirty) |
| 376 | ctf_integer(unsigned long, bdi_setpoint, |
| 377 | ((global_dirty_limit + (thresh + bg_thresh) / 2) / 2) * |
| 378 | bdi_thresh / (thresh + 1)) |
| 379 | ctf_integer(unsigned long, bdi_dirty, bdi_dirty) |
| 380 | ctf_integer(unsigned long, dirty_ratelimit, |
| 381 | KBps(dirty_ratelimit)) |
| 382 | ctf_integer(unsigned long, task_ratelimit, |
| 383 | KBps(task_ratelimit)) |
| 384 | ctf_integer(unsigned int, dirtied, dirtied) |
| 385 | ctf_integer(unsigned int, dirtied_pause, |
| 386 | current->nr_dirtied_pause) |
| 387 | ctf_integer(unsigned long, paused, |
| 388 | (jiffies - start_time) * 1000 / HZ) |
| 389 | ctf_integer(long, pause, pause * 1000 / HZ) |
| 390 | ctf_integer(unsigned long, period, |
| 391 | period * 1000 / HZ) |
| 392 | ctf_integer(long, think, |
| 393 | current->dirty_paused_when == 0 ? 0 : |
| 394 | (long)(jiffies - current->dirty_paused_when) * 1000/HZ) |
| 395 | ) |
| 396 | ) |
| 397 | |
| 398 | LTTNG_TRACEPOINT_EVENT(writeback_sb_inodes_requeue, |
| 399 | |
| 400 | TP_PROTO(struct inode *inode), |
| 401 | TP_ARGS(inode), |
| 402 | |
| 403 | TP_FIELDS( |
| 404 | ctf_string(name, lttng_bdi_dev_name(inode_to_bdi(inode))) |
| 405 | ctf_integer(unsigned long, ino, inode->i_ino) |
| 406 | ctf_integer(unsigned long, state, inode->i_state) |
| 407 | ctf_integer(unsigned long, dirtied_when, inode->dirtied_when) |
| 408 | ) |
| 409 | ) |
| 410 | |
| 411 | LTTNG_TRACEPOINT_EVENT_CLASS(writeback_congest_waited_template, |
| 412 | |
| 413 | TP_PROTO(unsigned int usec_timeout, unsigned int usec_delayed), |
| 414 | |
| 415 | TP_ARGS(usec_timeout, usec_delayed), |
| 416 | |
| 417 | TP_FIELDS( |
| 418 | ctf_integer(unsigned int, usec_timeout, usec_timeout) |
| 419 | ctf_integer(unsigned int, usec_delayed, usec_delayed) |
| 420 | ) |
| 421 | ) |
| 422 | |
| 423 | LTTNG_TRACEPOINT_EVENT_INSTANCE(writeback_congest_waited_template, writeback_congestion_wait, |
| 424 | |
| 425 | TP_PROTO(unsigned int usec_timeout, unsigned int usec_delayed), |
| 426 | |
| 427 | TP_ARGS(usec_timeout, usec_delayed) |
| 428 | ) |
| 429 | |
| 430 | LTTNG_TRACEPOINT_EVENT_INSTANCE(writeback_congest_waited_template, writeback_wait_iff_congested, |
| 431 | |
| 432 | TP_PROTO(unsigned int usec_timeout, unsigned int usec_delayed), |
| 433 | |
| 434 | TP_ARGS(usec_timeout, usec_delayed) |
| 435 | ) |
| 436 | |
| 437 | LTTNG_TRACEPOINT_EVENT_CLASS(writeback_single_inode_template, |
| 438 | |
| 439 | TP_PROTO(struct inode *inode, |
| 440 | struct writeback_control *wbc, |
| 441 | unsigned long nr_to_write |
| 442 | ), |
| 443 | |
| 444 | TP_ARGS(inode, wbc, nr_to_write), |
| 445 | |
| 446 | TP_FIELDS( |
| 447 | ctf_string(name, lttng_bdi_dev_name(inode_to_bdi(inode))) |
| 448 | ctf_integer(unsigned long, ino, inode->i_ino) |
| 449 | ctf_integer(unsigned long, state, inode->i_state) |
| 450 | ctf_integer(unsigned long, dirtied_when, inode->dirtied_when) |
| 451 | ctf_integer(unsigned long, writeback_index, |
| 452 | inode->i_mapping->writeback_index) |
| 453 | ctf_integer(long, nr_to_write, nr_to_write) |
| 454 | ctf_integer(unsigned long, wrote, |
| 455 | nr_to_write - wbc->nr_to_write) |
| 456 | ) |
| 457 | ) |
| 458 | |
| 459 | LTTNG_TRACEPOINT_EVENT_INSTANCE(writeback_single_inode_template, writeback_single_inode, |
| 460 | TP_PROTO(struct inode *inode, |
| 461 | struct writeback_control *wbc, |
| 462 | unsigned long nr_to_write), |
| 463 | TP_ARGS(inode, wbc, nr_to_write) |
| 464 | ) |
| 465 | |
| 466 | #endif /* LTTNG_TRACE_WRITEBACK_H */ |
| 467 | |
| 468 | /* This part must be outside protection */ |
| 469 | #include <lttng/define_trace.h> |