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