Fedora – Default I/O Scheduler in Fedora Workstation 29

fedoraiolinux-kernelscsi

If it depends on the exact type of block device, then what is the default I/O scheduler for each type of device?

Background information

Fedora 29 includes a Linux kernel from the 4.19 series. (Technically, the initial release used a 4.18 series kernel. But a 4.19 kernel is installed by the normal software updates).

Starting in version 4.19, the mainline kernel has CONFIG_SCSI_MQ_DEFAULT as default y. I.e. that's what you get if you take the tree published by Linus, without applying any Fedora-specific patches. By default, SCSI and SATA devices will use the new multi-queue block layer. (Linux treats SATA devices as being SCSI, using a translation based on the SAT standard).

This is a transitional step towards removing the old code. All the old code will now be removed in version 4.21 5.0, the next kernel release after 4.20.

In the new MQ system, block devices use a new set of I/O schedulers. These include none, mq-deadline, and bfq. In the mainline 4.19 kernel, the default scheduler is set as follows:

/* For blk-mq devices, we default to using mq-deadline, if available, for single
queue devices. If deadline isn't available OR we have multiple queues,
default to "none". */

A suggestion has been made to use BFQ as the default in place of mq-deadline. This suggestion was not accepted for 4.19.

For the legacy SQ block layer, the default scheduler is CFQ, which is most similar to BFQ.

=> The kernel's default I/O scheduler can vary, depending on the type of device: SCSI/SATA, MMC/eMMC, etc.

CFQ attempts to support some level of "fairness" and I/O priorities (ionice). It has various complexities. BFQ is even more complex; it supports ionice but also has heuristics to classify and prioritize some I/O automatically. deadline style scheduling is simpler; it does not support ionice at all.

=> Users with the Linux default kernel configuration, SATA devices, and no additional userspace policy (e.g. no udev rules), will be subject to a change in behaviour in 4.19. Where ionice used to work, it will no longer have any effect.

However Fedora includes specific kernel patches / configuration. Fedora also includes userspace policies such as default udev rules.

What does Fedora Workstation 29 use as the default I/O scheduler? If it depends on the exact type of block device, then what is the default I/O scheduler for each type of device?

Best Answer

Fedora 29 ships with the 4.18.16 kernel. It appears that CFQ is the default.

$ grep CONFIG_DEFAULT_IOSCHED= /boot/config-4.18.16-300.fc29.x86_64 
CONFIG_DEFAULT_IOSCHED="cfq"
$ grep CONFIG_SCSI_MQ_DEFAULT /boot/config-4.18.16-300.fc29.x86_64 
# CONFIG_SCSI_MQ_DEFAULT is not set
$ cat /sys/block/sda/queue/scheduler
noop deadline [cfq] 

As of this writing (November 24, 2018), 4.19.3 is available as update for F29. But, the config options do not appear to have changed.

4.20.0 (RC1) is in the "Rawhide" devel tree. In that devel-tree kernel, CFQ is still the default, and CONFIG_SCSI_MQ_DEFAULT is still unset. The Fedora Kernel list at https://lists.fedoraproject.org/archives/list/kernel@lists.fedoraproject.org/ is the best place to discuss whether this should change.

Related Question