Re: msleep() an load average

From: Clemens Ladisch
Date: Wed May 04 2011 - 10:28:47 EST


Eibach, Dirk wrote:
> > 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. ;-)


Regards,
Clemens
--
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/