Linux 4.2 Will Tweak The CFQ Scheduler For SSDs To Offer Better Performance

Written by Michael Larabel in Linux Kernel on 6 June 2015 at 09:38 AM EDT. 21 Comments
LINUX KERNEL
The Linux 4.2 kernel will make the CFQ I/O scheduler default to its IOPS mode when on solid-state drives, which should boost performance.

Tahsin Erdogan, an engineer at Google working on Linux kernel storage, sent in the tiny patch last month for setting the CFQ I/O scheduler mode to IOPS when running on an SSD. That patch has now been accepted by Linux block maintainer Jens Axboe who has queued it up for Linux 4.2.

Erdogan explained, "CFQ idling causes reduced IOPS throughput on non-rotational disks. Since disk head seeking is not applicable to SSDs, it doesn't really help performance by anticipating future near-by IO requests. By turning off idling (and switching to IOPS mode), we allow other processes to dispatch IO requests down to the driver and so increase IO throughput."

This change caused the cloud SSD performance in the FIO disk benchmark to increase by more than four times. With a local solid state drive, the performance was about 12% faster under FIO. Of course, once Linux 4.2 enters development we'll be running our usual benchmarks plus we have our daily Linux kernel benchmarks over on the recently opened LinuxBenchmarking.com. For those unfamiliar with the CFQ IOPS mode, below is the description from the kernel documentation.
Basic CFQ design is to provide priority based time slices. Higher priority process gets bigger time slice and lower priority process gets smaller time slice. Measuring time becomes harder if storage is fast and supports NCQ and it would be better to dispatch multiple requests from multiple cfq queues in request queue at a time. In such scenario, it is not possible to measure time consumed by single queue accurately.

What is possible though is to measure number of requests dispatched from a single queue and also allow dispatch from multiple cfq queue at the same time. This effectively becomes the fairness in terms of IOPS (IO operations per second).

If one sets slice_idle=0 and if storage supports NCQ, CFQ internally switches to IOPS mode and starts providing fairness in terms of number of requests dispatched. Note that this mode switching takes effect only for group scheduling. For non-cgroup users nothing should change.
Related News
About The Author
Michael Larabel

Michael Larabel is the principal author of Phoronix.com and founded the site in 2004 with a focus on enriching the Linux hardware experience. Michael has written more than 20,000 articles covering the state of Linux hardware support, Linux performance, graphics drivers, and other topics. Michael is also the lead developer of the Phoronix Test Suite, Phoromatic, and OpenBenchmarking.org automated benchmarking software. He can be followed via Twitter, LinkedIn, or contacted via MichaelLarabel.com.

Popular News This Week