您可以在启动时通过将“elevator”参数添加到内核 cmdline(例如在 grub.cfg 中)来设置它
例子:
elevator=deadline
这将使“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。
希望这可以帮助!
编辑:免责声明,这些是我写的脚本。