Mauro Carvalho Chehab | 898bd37 | 2019-04-18 19:45:00 -0300 | [diff] [blame] | 1 | =================== |
| 2 | Switching Scheduler |
| 3 | =================== |
| 4 | |
Alan D. Brunelle | 23c7698 | 2007-10-15 13:22:26 +0200 | [diff] [blame] | 5 | Each io queue has a set of io scheduler tunables associated with it. These |
| 6 | tunables control how the io scheduler works. You can find these entries |
Mauro Carvalho Chehab | 898bd37 | 2019-04-18 19:45:00 -0300 | [diff] [blame] | 7 | in:: |
Alan D. Brunelle | 23c7698 | 2007-10-15 13:22:26 +0200 | [diff] [blame] | 8 | |
Mauro Carvalho Chehab | 898bd37 | 2019-04-18 19:45:00 -0300 | [diff] [blame] | 9 | /sys/block/<device>/queue/iosched |
Alan D. Brunelle | 23c7698 | 2007-10-15 13:22:26 +0200 | [diff] [blame] | 10 | |
| 11 | assuming that you have sysfs mounted on /sys. If you don't have sysfs mounted, |
Mauro Carvalho Chehab | 898bd37 | 2019-04-18 19:45:00 -0300 | [diff] [blame] | 12 | you can do so by typing:: |
Alan D. Brunelle | 23c7698 | 2007-10-15 13:22:26 +0200 | [diff] [blame] | 13 | |
Mauro Carvalho Chehab | 898bd37 | 2019-04-18 19:45:00 -0300 | [diff] [blame] | 14 | # mount none /sys -t sysfs |
Alan D. Brunelle | 23c7698 | 2007-10-15 13:22:26 +0200 | [diff] [blame] | 15 | |
Andreas Herrmann | 8614b00 | 2019-06-12 08:50:09 +0200 | [diff] [blame] | 16 | It is possible to change the IO scheduler for a given block device on |
| 17 | the fly to select one of mq-deadline, none, bfq, or kyber schedulers - |
| 18 | which can improve that device's throughput. |
Valdis Kletnieks | 73af994 | 2006-04-19 09:23:09 +0200 | [diff] [blame] | 19 | |
Mauro Carvalho Chehab | 898bd37 | 2019-04-18 19:45:00 -0300 | [diff] [blame] | 20 | To set a specific scheduler, simply do this:: |
Valdis Kletnieks | 73af994 | 2006-04-19 09:23:09 +0200 | [diff] [blame] | 21 | |
Mauro Carvalho Chehab | 898bd37 | 2019-04-18 19:45:00 -0300 | [diff] [blame] | 22 | echo SCHEDNAME > /sys/block/DEV/queue/scheduler |
Valdis Kletnieks | 73af994 | 2006-04-19 09:23:09 +0200 | [diff] [blame] | 23 | |
| 24 | where SCHEDNAME is the name of a defined IO scheduler, and DEV is the |
| 25 | device name (hda, hdb, sga, or whatever you happen to have). |
| 26 | |
| 27 | The list of defined schedulers can be found by simply doing |
| 28 | a "cat /sys/block/DEV/queue/scheduler" - the list of valid names |
Mauro Carvalho Chehab | 898bd37 | 2019-04-18 19:45:00 -0300 | [diff] [blame] | 29 | will be displayed, with the currently selected scheduler in brackets:: |
Valdis Kletnieks | 73af994 | 2006-04-19 09:23:09 +0200 | [diff] [blame] | 30 | |
Mauro Carvalho Chehab | 898bd37 | 2019-04-18 19:45:00 -0300 | [diff] [blame] | 31 | # cat /sys/block/sda/queue/scheduler |
| 32 | [mq-deadline] kyber bfq none |
| 33 | # echo none >/sys/block/sda/queue/scheduler |
| 34 | # cat /sys/block/sda/queue/scheduler |
| 35 | [none] mq-deadline kyber bfq |