Document which drivers are using MSI and how it can be disabled.
[dragonfly.git] / share / man / man4 / dsched_bfq.4
1 .\"
2 .\" Copyright (c) 2011
3 .\"     The DragonFly Project.  All rights reserved.
4 .\"
5 .\" Redistribution and use in source and binary forms, with or without
6 .\" modification, are permitted provided that the following conditions
7 .\" are met:
8 .\"
9 .\" 1. Redistributions of source code must retain the above copyright
10 .\"    notice, this list of conditions and the following disclaimer.
11 .\" 2. Redistributions in binary form must reproduce the above copyright
12 .\"    notice, this list of conditions and the following disclaimer in
13 .\"    the documentation and/or other materials provided with the
14 .\"    distribution.
15 .\" 3. Neither the name of The DragonFly Project nor the names of its
16 .\"    contributors may be used to endorse or promote products derived
17 .\"    from this software without specific, prior written permission.
18 .\"
19 .\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 .\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 .\" LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
22 .\" FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE
23 .\" COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
24 .\" INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING,
25 .\" BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
26 .\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
27 .\" AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28 .\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
29 .\" OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 .\" SUCH DAMAGE.
31 .\"
32 .Dd August 19, 2011
33 .Dt DSCHED_BFQ 4
34 .Os
35 .Sh NAME
36 .Nm dsched_bfq
37 .Nd Budget Fair Queueing disk scheduling policy
38 .Sh SYNOPSIS
39 To compile this driver into the kernel,
40 place the following lines in your
41 kernel configuration file:
42 .Bd -ragged -offset indent
43 .Cd "options dsched_bfq"
44 .Ed
45 .Pp
46 Alternatively, to load the driver as a
47 module at boot time, place the following line in
48 .Xr loader.conf 5 :
49 .Bd -literal -offset indent
50 dsched_bfq_load="YES"
51 .Ed
52 .Sh DESCRIPTION
53 The
54 .Nm
55 disk scheduler is invented by Paolo Valente.
56 The current version of
57 .Nm
58 in
59 .Dx
60 is implemented according to his technique report.
61 Also, some additional features are added into the current version;
62 they are inspired by the Linux version, but are totally written from scratch.
63 .Pp
64 Like the CFQ (Complete Fair Queue) disk scheduler under Linux,
65 .Nm
66 is a fair queueing scheduler that aims to improve the interactivity and
67 lower the latency of the system.
68 Maximizing throughput, however, is not the major design goal of it.
69 So it is better to switch to
70 .Nm
71 if the computer is for desktop usage, in which interactivity eclipses
72 throughput in general.
73 .Ss Switching To BFQ
74 You may use
75 .Xr sysctl 8
76 to switch to
77 .Nm
78 (where
79 .Dq ad0
80 is the name of your hard drive):
81 .Bd -literal -offset indent
82 sysctl dsched.policy.ad0=bfq
83 .Ed
84 .Pp
85 A loader tunable of the same name is available for setting it permanently.
86 .Ss Tuning BFQ
87 Currently
88 .Nm
89 has two tunable parameters: the global AS switch and the maximum budget.
90 They can be tuned by the
91 .Xr sysctl 8
92 command, for example:
93 .Bd -literal -offset indent
94 #enable the global AS feature:
95 sysctl dsched.bfq.ad0.as_switch=1
96
97 #set the max budget to 512KB:
98 sysctl dsched.bfq.ad0.max_budget=524288
99
100 #enable automatic max budget adapting:
101 sysctl dsched.bfq.ad0.auto_max_budget=0
102 .Ed
103 .Bl -tag -width indent
104 .It The AS feature
105 It is reported that turning AS on may affect the interactivity and increase
106 max latency greatly.
107 It is probably due to the over-serialized implementation of BFQ.
108 However, the blogbench shows that turning AS
109 on will also increase the throughput greatly.
110 .Pp
111 Suggestion: turn on the AS feature, for it effects little on average
112 latency.
113 .It The max budget
114 One thread could be assigned a budget no more than the max budget.
115 Generally,
116 a higher budget means higher throughput because of less operations on
117 WF2Q+ augtree, while a lower budget force the scheduler cost more on
118 those operations.
119 .Pp
120 However, the real world experiments show that a too high budget affects
121 interactivity heavily.
122 A too low budget will also cause higher latency, and
123 if the budget is less than 64KB (65536), which is smaller than the size of
124 some bios, the scheduler will retrograde to a round-robin scheduler, which
125 is not a good form for a disk scheduler.
126 .Pp
127 Suggestions: Do not use automatic max budget, it is usually too high.
128 A budget of 1/10 of the automatic max budget may be proper.
129 In general, 512K(default), 256K, 192K can be good.
130 It is better to determine the
131 best max budget by binary selecting by the result of some benchmarks.
132 .El
133 .Sh SEE ALSO
134 .Xr dsched 4 ,
135 .Xr kldload 8 ,
136 .Xr sysctl 8
137 .Pp
138 .Pa http://leaf.dragonflybsd.org/~brillsp/bfq_doc/bfq.html
139 .Sh HISTORY
140 The
141 .Nm
142 scheduler first appeared in
143 .Dx 2.11 .
144 .Sh AUTHORS
145 The
146 .Nm
147 scheduling policy was written by
148 .An Brills Peng.
149 .Sh BUGS
150 When switching to another dsched policy from BFQ, the system may deadlock.
151 .Pp
152 Currently, the overall performance is not very good and it is not tested on
153 large number of machines.
154 It is not recommended to use this version in a productivity environment.