aboutsummaryrefslogtreecommitdiffstats
path: root/include/trace
diff options
context:
space:
mode:
authorJens Axboe <axboe@fb.com>2016-11-09 14:36:15 -0500
committerJens Axboe <axboe@fb.com>2016-11-10 15:53:32 -0500
commite34cbd307477ae07c5d8a8d0bd15e65a9ddaba5c (patch)
tree2cf40c43afdc01d953eae0098c4f8bb4d760c8d9 /include/trace
parentcf43e6be865a582ba66ee4747ae27a0513f6bba1 (diff)
blk-wbt: add general throttling mechanism
We can hook this up to the block layer, to help throttle buffered writes. wbt registers a few trace points that can be used to track what is happening in the system: wbt_lat: 259:0: latency 2446318 wbt_stat: 259:0: rmean=2446318, rmin=2446318, rmax=2446318, rsamples=1, wmean=518866, wmin=15522, wmax=5330353, wsamples=57 wbt_step: 259:0: step down: step=1, window=72727272, background=8, normal=16, max=32 This shows a sync issue event (wbt_lat) that exceeded it's time. wbt_stat dumps the current read/write stats for that window, and wbt_step shows a step down event where we now scale back writes. Each trace includes the device, 259:0 in this case. Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'include/trace')
-rw-r--r--include/trace/events/wbt.h153
1 files changed, 153 insertions, 0 deletions
diff --git a/include/trace/events/wbt.h b/include/trace/events/wbt.h
new file mode 100644
index 000000000000..3c518e455680
--- /dev/null
+++ b/include/trace/events/wbt.h
@@ -0,0 +1,153 @@
1#undef TRACE_SYSTEM
2#define TRACE_SYSTEM wbt
3
4#if !defined(_TRACE_WBT_H) || defined(TRACE_HEADER_MULTI_READ)
5#define _TRACE_WBT_H
6
7#include <linux/tracepoint.h>
8#include "../../../block/blk-wbt.h"
9
10/**
11 * wbt_stat - trace stats for blk_wb
12 * @stat: array of read/write stats
13 */
14TRACE_EVENT(wbt_stat,
15
16 TP_PROTO(struct backing_dev_info *bdi, struct blk_rq_stat *stat),
17
18 TP_ARGS(bdi, stat),
19
20 TP_STRUCT__entry(
21 __array(char, name, 32)
22 __field(s64, rmean)
23 __field(u64, rmin)
24 __field(u64, rmax)
25 __field(s64, rnr_samples)
26 __field(s64, rtime)
27 __field(s64, wmean)
28 __field(u64, wmin)
29 __field(u64, wmax)
30 __field(s64, wnr_samples)
31 __field(s64, wtime)
32 ),
33
34 TP_fast_assign(
35 strncpy(__entry->name, dev_name(bdi->dev), 32);
36 __entry->rmean = stat[0].mean;
37 __entry->rmin = stat[0].min;
38 __entry->rmax = stat[0].max;
39 __entry->rnr_samples = stat[0].nr_samples;
40 __entry->wmean = stat[1].mean;
41 __entry->wmin = stat[1].min;
42 __entry->wmax = stat[1].max;
43 __entry->wnr_samples = stat[1].nr_samples;
44 ),
45
46 TP_printk("%s: rmean=%llu, rmin=%llu, rmax=%llu, rsamples=%llu, "
47 "wmean=%llu, wmin=%llu, wmax=%llu, wsamples=%llu\n",
48 __entry->name, __entry->rmean, __entry->rmin, __entry->rmax,
49 __entry->rnr_samples, __entry->wmean, __entry->wmin,
50 __entry->wmax, __entry->wnr_samples)
51);
52
53/**
54 * wbt_lat - trace latency event
55 * @lat: latency trigger
56 */
57TRACE_EVENT(wbt_lat,
58
59 TP_PROTO(struct backing_dev_info *bdi, unsigned long lat),
60
61 TP_ARGS(bdi, lat),
62
63 TP_STRUCT__entry(
64 __array(char, name, 32)
65 __field(unsigned long, lat)
66 ),
67
68 TP_fast_assign(
69 strncpy(__entry->name, dev_name(bdi->dev), 32);
70 __entry->lat = div_u64(lat, 1000);
71 ),
72
73 TP_printk("%s: latency %lluus\n", __entry->name,
74 (unsigned long long) __entry->lat)
75);
76
77/**
78 * wbt_step - trace wb event step
79 * @msg: context message
80 * @step: the current scale step count
81 * @window: the current monitoring window
82 * @bg: the current background queue limit
83 * @normal: the current normal writeback limit
84 * @max: the current max throughput writeback limit
85 */
86TRACE_EVENT(wbt_step,
87
88 TP_PROTO(struct backing_dev_info *bdi, const char *msg,
89 int step, unsigned long window, unsigned int bg,
90 unsigned int normal, unsigned int max),
91
92 TP_ARGS(bdi, msg, step, window, bg, normal, max),
93
94 TP_STRUCT__entry(
95 __array(char, name, 32)
96 __field(const char *, msg)
97 __field(int, step)
98 __field(unsigned long, window)
99 __field(unsigned int, bg)
100 __field(unsigned int, normal)
101 __field(unsigned int, max)
102 ),
103
104 TP_fast_assign(
105 strncpy(__entry->name, dev_name(bdi->dev), 32);
106 __entry->msg = msg;
107 __entry->step = step;
108 __entry->window = div_u64(window, 1000);
109 __entry->bg = bg;
110 __entry->normal = normal;
111 __entry->max = max;
112 ),
113
114 TP_printk("%s: %s: step=%d, window=%luus, background=%u, normal=%u, max=%u\n",
115 __entry->name, __entry->msg, __entry->step, __entry->window,
116 __entry->bg, __entry->normal, __entry->max)
117);
118
119/**
120 * wbt_timer - trace wb timer event
121 * @status: timer state status
122 * @step: the current scale step count
123 * @inflight: tracked writes inflight
124 */
125TRACE_EVENT(wbt_timer,
126
127 TP_PROTO(struct backing_dev_info *bdi, unsigned int status,
128 int step, unsigned int inflight),
129
130 TP_ARGS(bdi, status, step, inflight),
131
132 TP_STRUCT__entry(
133 __array(char, name, 32)
134 __field(unsigned int, status)
135 __field(int, step)
136 __field(unsigned int, inflight)
137 ),
138
139 TP_fast_assign(
140 strncpy(__entry->name, dev_name(bdi->dev), 32);
141 __entry->status = status;
142 __entry->step = step;
143 __entry->inflight = inflight;
144 ),
145
146 TP_printk("%s: status=%u, step=%d, inflight=%u\n", __entry->name,
147 __entry->status, __entry->step, __entry->inflight)
148);
149
150#endif /* _TRACE_WBT_H */
151
152/* This part must be outside protection */
153#include <trace/define_trace.h>