RE: msleep() an load average

From: Eibach, Dirk
Date: Wed May 04 2011 - 10:47:53 EST



> > > Uninterruptible sleeps count as I/O load.
> >
> > Is there any practical reason behind this or was it just an
> igenious
> > invention to annoy those smug userspace developers?
>
> Historically, uninterruptible sleeps were the best way to
> detect I/O load. Furthermore, a process that is doing I/O is
> very likely to continue running soon, while other sleeps are
> more likely to indicate that the process is waiting for some
> event to wake it up to begin doing something, so this better
> predicts CPU load. Finally, a busy device is likely to
> prevent other programs from running well, so it makes sense
> to count this against the load.
>
> msleep() is commonly used to handle device communication
> delays, which is essentially the same case as waiting for
> disk I/O. It might be possible to introduce some new flags
> or functions to allow long uninterruptible sleeps that do not
> affect the load, but this has not been necessary so far
> because knowledge of this quirk of the load heuristic is
> necessary for every great kernel hacker. ;-)

So summarizing we could say that semantics for signalling I/O load to
loadavg are historically crippled and msleep() should be avoided if you
don't want to mess up loadavg.
In addition I realize that studying LDD does not make you a great kernel
hacker ;)

Cheers
Dirk


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/