在/etc/default/grub中启动:
GRUB_CMDLINE_LINUX="scsi_mod.use_blk_mq=1(0是关闭)"
并重新生成grub:
grub-mkconfig -o /boot/grub/grub.cfg
另外blk_mq调度系统是不支持grub中的电梯标记,也就是grub中的:
GRUB_CMDLINE_LINUX_DEFAULT="elevator=none"
需要使用udev规则,在/etc/udev/rules.d中创建一个scheduler.rules,添加如下:
- ACTION=="add|change", KERNEL=="sd*[!0-9]|sr*", ATTR{queue/scheduler}="bfq"<---也可是别的多队列调度器
- # set deadline scheduler for non-rotating disks
- ACTION=="add|change", KERNEL=="sd[a-z]", ATTR{queue/rotational}=="0",ATTR{queue/scheduler}="bfq"
- # set bfq scheduler for rotating disks
- ACTION=="add|change", KERNEL=="sd[a-z]", ATTR{queue/rotational}=="1", ATTR{queue/scheduler}="deadline"
- # set mq-deadline scheduler for non-rotating nvme-disks
- ACTION=="add|change", KERNEL=="nvme[0-9]n1", ATTR{queue/rotational}=="0", ATTR{queue/scheduler}="bfq"
至于多队列调度器和单队列调度器的优劣,请自行百度,暂时先写到这里,有问题再更新