Selectable I/O schedulers for 2.6
[Posted September 24, 2003 by corbet]
The 2.5 development series saw the creation of a few different I/O
schedulers ("elevators") for the block I/O subsystem. I/O schedulers
attempt to perform requested block I/O operations in an order that
maximizes performance. Given that different people (and applications)
measure performance differently, it is not surprising that more than one
I/O scheduler exists. So, for example, the "deadline" scheduler attempts
to minimize
seeks while ensuring that no request waits for more than a certain period
of time. The anticipatory scheduler pauses after completing read
operations on the assumption that another nearby read will show up
quickly. The CFQ ("completely fair queueing") scheduler tries to divide up
the available I/O bandwidth equally among processes. And there is a "noop"
scheduler for devices (such as memory-based devices) which do not benefit
from I/O scheduling logic at all.
What has been lacking is any sort of way for a system administrator to
choose between these schedulers. A system I/O scheduler
can be designated with the elevator= boot parameter, but that
choice applies to all drives on the system, and it cannot be changed. This
restriction makes experimenting with the various schedulers difficult; in
the real world, it may also be appropriate to use different schedulers for
different drives.
So Nick Piggin has released a patch which
makes I/O schedulers selectable at run time. With the patch, a new
io_scheduler sysfs attribute appears under
/sys/block/<device>/queue; changing a scheduler is simply a
matter of writing the name of the new scheduler into that attribute. So,
for example, to go to CFQ on the first SCSI drive:
echo cfq >/sys/block/sda/queue/io_scheduler
Changing schedulers requires pausing and emptying the I/O queue, so it
might not be advisable in the middle of writing a CD or controlling a
nuclear power plant shutdown. But it certainly can be a useful thing to do
at system initialization time, or while experimenting with scheduler
performance under a certain kind of load.
(
Log in to post comments)