Re: Time sliced CFQ io scheduler

Nick Piggin
2004-12-08T01:47:19Z

On Wed, 2004-12-08 at 02:37 +0100, Andrea Arcangeli wrote:
> On Wed, Dec 08, 2004 at 11:54:13AM +1100, Nick Piggin wrote:
> > That is synch write bandwidth. Yes that seems to be a problem.
>
> It's not just sync write, it's a write in general, blkdev doesn't know
> if the one waiting is pdflush or some other task. Once this will be
> fixed I will have to reconsider my opinion of course, but I guess after

Yeah those sorts of dependencies are tricky. I think the best bet is
to not get _too_ fancy, and try to cover the basics like keeping
fairness good, and minimising write latency as much as possible.

> it gets fixed the benefit of "as" on the desktop will as well decrease
> compared to cfq. The desktop is ok with "as" simply because it's
> normally optimal to stop writes completely, since there are few apps
> doing write journaling or heavy writes, and there's normally no
> contigous read happening in the background. Desktop just needs a
> temporary peak read max bandwidth when you click on openoffice or
> similar app (and "as" provides it). But on a mixed server doing some
> significant read and write (i.e. somebody downloading the kernel from
> kernel.org and installing it on some application server) I don't think
> "as" is general purpose enough. Another example is the multiuser usage
> with one user reading a big mbox folder in mutt, whole the other user
> s exiting mutt at the same time. The one exiting will pratically have to
> wait the first user to finish its read I/O. All I/O becomes sync when it
> exceeds the max size of the writeback cache.
>

AS is surprisingly good when doing concurrent reads and buffered writes.
The buffered writes don't get starved too badly. Basically, AS just
ensures a reader will get the chance to play out its entire read batch
before switching to another reader or a writer.

Buffered writes don't suffer the same problem obviously because the
disk can can easily be kept fed from cache. Any read vs buffered write
starvation you see will mainly be due to the /sys tunables that give
more priority to reads (which isn't a bad idea, generally).

> "as" is clearly the best for the common case of the very desktop usage
> (i.e. machine 99.9% idle and without any I/O except when starting an app
> or saving a file, and the user noticing delay only while waiting the
> window to open up after he clicked the button). But I believe cfq is
> better for a general purpose usage where we cannot assume how the kernel
> will be used.

Maybe. CFQ may be a bit closer to a traditional elevator behaviour,
while AS uses some significantly different concepts which I guess
aren't as well tested and optimised for.