您可以在启动时通过向内核cmdline添加“ elevator”参数来进行设置(例如在grub.cfg中)
例:
elevator=deadline
这将使“截止期限”成为所有块设备的默认I / O调度程序。
如果您想在系统启动后查询或更改调度程序,或者想为特定的块设备使用其他调度程序,建议您安装并使用ioschedset工具来简化此操作。
https://github.com/kata198/ioschedset
如果您使用的是Archlinux,则可以在aur中使用:
https://aur.archlinux.org/packages/ioschedset
一些示例用法:
# Get i/o scheduler for all block devices
[username@hostname ~]$ io-get-sched
sda: bfq
sr0: bfq
# Query available I/O schedulers
[username@hostname ~]$ io-set-sched --list
mq-deadline kyber bfq none
# Set sda to use "kyber"
[username@hostname ~]$ io-set-sched kyber /dev/sda
Must be root to set IO Scheduler. Rerunning under sudo...
[sudo] password for username:
+ Successfully set sda to 'kyber'!
# Get i/o scheduler for all block devices to assert change
[username@hostname ~]$ io-get-sched
sda: kyber
sr0: bfq
# Set all block devices to use 'deadline' i/o scheduler
[username@hostname ~]$ io-set-sched deadline
Must be root to set IO Scheduler. Rerunning under sudo...
+ Successfully set sda to 'deadline'!
+ Successfully set sr0 to 'deadline'!
# Get the current block scheduler just for sda
[username@hostname ~]$ io-get-sched sda
sda: mq-deadline
用法应该是不言自明的。这些工具是独立的,仅需要bash。
希望这可以帮助!
编辑:免责声明,这些是我编写的脚本。