xref: /OK3568_Linux_fs/kernel/Documentation/block/switching-sched.rst (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun===================
2*4882a593SmuzhiyunSwitching Scheduler
3*4882a593Smuzhiyun===================
4*4882a593Smuzhiyun
5*4882a593SmuzhiyunEach io queue has a set of io scheduler tunables associated with it. These
6*4882a593Smuzhiyuntunables control how the io scheduler works. You can find these entries
7*4882a593Smuzhiyunin::
8*4882a593Smuzhiyun
9*4882a593Smuzhiyun	/sys/block/<device>/queue/iosched
10*4882a593Smuzhiyun
11*4882a593Smuzhiyunassuming that you have sysfs mounted on /sys. If you don't have sysfs mounted,
12*4882a593Smuzhiyunyou can do so by typing::
13*4882a593Smuzhiyun
14*4882a593Smuzhiyun	# mount none /sys -t sysfs
15*4882a593Smuzhiyun
16*4882a593SmuzhiyunIt is possible to change the IO scheduler for a given block device on
17*4882a593Smuzhiyunthe fly to select one of mq-deadline, none, bfq, or kyber schedulers -
18*4882a593Smuzhiyunwhich can improve that device's throughput.
19*4882a593Smuzhiyun
20*4882a593SmuzhiyunTo set a specific scheduler, simply do this::
21*4882a593Smuzhiyun
22*4882a593Smuzhiyun	echo SCHEDNAME > /sys/block/DEV/queue/scheduler
23*4882a593Smuzhiyun
24*4882a593Smuzhiyunwhere SCHEDNAME is the name of a defined IO scheduler, and DEV is the
25*4882a593Smuzhiyundevice name (hda, hdb, sga, or whatever you happen to have).
26*4882a593Smuzhiyun
27*4882a593SmuzhiyunThe list of defined schedulers can be found by simply doing
28*4882a593Smuzhiyuna "cat /sys/block/DEV/queue/scheduler" - the list of valid names
29*4882a593Smuzhiyunwill be displayed, with the currently selected scheduler in brackets::
30*4882a593Smuzhiyun
31*4882a593Smuzhiyun  # cat /sys/block/sda/queue/scheduler
32*4882a593Smuzhiyun  [mq-deadline] kyber bfq none
33*4882a593Smuzhiyun  # echo none >/sys/block/sda/queue/scheduler
34*4882a593Smuzhiyun  # cat /sys/block/sda/queue/scheduler
35*4882a593Smuzhiyun  [none] mq-deadline kyber bfq
36