ATA Command Priority Support For The Linux 4.10 Kernel

Written by Michael Larabel in Linux Kernel on 13 December 2016 at 03:00 AM EST. 3 Comments
The libata updates for the Linux 4.10 kernel brings support for ATA Command Priorities, but it's a feature disabled by default.

Tejun Heo mailed in the 4.10 libata changes. What make the libata code in Linux 4.10 worth noting is the ATA Command Priorities support.

This work allows supporting NCQ command priorities, assuming it's supported by the underlying device. These patches for the Linux kernel were worked on by a Western Digital developer, Adam Manzanares. The NCQ priority support is outlined in this ATA/ATAPI command set documentation from 2013.

The priority modes include normal priority, isochronous deadline-dependent priority, and a high priority. The high priority mode signifies that there should be an "attempt to provide better quality of service for the command. The device should complete high priority requests in a more timely fashion than normal and isochronous requests." The NCQ command priorities is just supported by newer storage drives.

Developer Adam Manzanares explained in an earlier version of these patches more about this ATA Command Priorities work:
This patch builds ATA commands with high priority if the iocontext of a process is set to real time. The goal of the patch is to improve tail latencies of workloads that use higher queue depths. This requires setting the iocontext ioprio on the request when it is initialized.

This patch has been tested with an Ultrastar HE8 HDD and cuts the the p99.99 tail latency of foreground IO from 2s down to 72ms when using the deadline scheduler. This patch works independently of the scheduler so it can be used with all of the currently available request based schedulers.

Foreground IO, for the previously described results, is an async fio job submitting 4K read requests at a QD of 1 to the HDD. The foreground IO is set with the iopriority class of real time. The background workload is another fio job submitting read requests at a QD of 32 to the same HDD with default iopriority.

Going from two seconds down to 72ms is exciting with this change on a supported drive. The command priority support is disabled by default but with a supported drive can be enabled via enable_prio on sysfs. Linux 4.10 is looking so far like we should be seeing a fair amount of Linux storage improvements from this to the block code to file-system work like the several additions to F2FS.
Related News
About The Author
Michael Larabel

Michael Larabel is the principal author of 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 automated benchmarking software. He can be followed via Twitter, LinkedIn, or contacted via

Popular News This Week