Ben's notes

Linux, Unix, network, radio...

User Tools

Site Tools


Change I/O scheduler

Do you need to change the scheduler?

CFQ is the default scheduler. If you have a specific use case, then you should benchmark the different schedulers. Quote:

CFQ has some optimizations for SSDs and if it detects a non-rotational
media which can support higher queue depth (multiple requests at in
flight at a time), then it cuts down on idling of individual queues and
all the queues move to sync-noidle tree and only tree idle remains. This
tree idling provides isolation with buffered write queues on async tree.

Current scheduler

Check current scheduler setting for sda:

$ cat /sys/block/sda/queue/scheduler
[noop] deadline cfq

Change scheduler

echo "noop" > /sys/block/sda/queue/scheduler
For all disks

Add to the kernel line in /etc/grub.conf

For specific SSD's using udev

Using udev:


# set noop scheduler for non-rotating disks
ACTION=="add|change", KERNEL=="sd[a-z]", TEST!="queue/rotational", ATTR{queue/scheduler}="noop"
ACTION=="add|change", KERNEL=="sd[a-z]", ATTR{queue/rotational}=="0", ATTR{queue/scheduler}="noop"

# set cfq scheduler for rotating disks
ACTION=="add|change", KERNEL=="sd[a-z]", ATTR{queue/rotational}=="1", ATTR{queue/scheduler}="cfq"
change_i_o_scheduler_elevator.txt · Last modified: 2021/10/09 15:14 by