Re: I/O request ordering

Linus Torvalds (torvalds@cs.helsinki.fi)
Tue, 6 Aug 1996 11:55:46 +0300 (EET DST)


On Mon, 5 Aug 1996, Ray Van Tassle-CRV004 wrote:
>
> For some time, I have had doubts about the I/O request ordering algorithm in
> drivers/block/ll_blk_rw. Upon examination, it turned out that (as I
> suspected) it is a sawtooth rather than an elevator. And it also
> has a bug.

Both the sawtooth and the "bug" are actually intentional. I don't guarantee
that they are _good_, but the idea is that we want to avoid starvation, and
the current IO request ordering should be fairer wrt latency than a elevator.

Also, there is another reason for saw-tooth as opposed to real elevator:
many harddisks will do pre-fetching, and perform much better if we always
read starting from low sectors to high.

If you _really_ want to improve performance, you should probably not use an
elevator. Instead, you should use something like "saw-tooth with a window",
where the "window" part is that the ordering algorithm will actually accept a
"backwards" request if it is within an acceptance window (of say 5% of the
disk or something like that). That can help a lot due to drive caching
(generally track caches).

(Kernel compile times are probably not good indications of disk ordering
performance, at least not if you have enough memory. I see 90% CPU use for
them most of the time).

Linus