On Thu, 2005-07-14 at 09:37 -0700, Linus Torvalds wrote:
> There should be an _absolute_ interface
I'm not arguing there shouldn't be an absolute interface. I'm arguing
that *most* uses are relative, and as such a relative interface makes
sense for those cases.
> Btw, this is exactly why the jiffy-based thing is _good_. The kernel
> timers _are_ absolute, and you make them relative by adding "jiffies".
again there is absolutely nothing wrong with having absolute timers and
a general notion of absolute time. Jiffies is one way of achieving that,
and it's the current linux way. I see the "absolute timers are good"
argument sort of separate from "jiffies / HZ are good" argument; there
is no principal reason why such an interface couldn't be in say usec.
> There's absolutely nothing wrong with "jiffies", and anybody who thinks
> that
>
> msleep(20);
>
> is fundamentally better than
>
> timeout = jiffies + HZ/50;
I *will* argue that for relative delays in drivers, msleep() is better.
The reason is different than you think of; the argument why I consider
msleep() better as interface for relative delays in drivers is that it
is harder for a driver writer to get wrong, by virtue of it being
simpler. jiffies and HZ conversion is one of those areas that driver
writers very often get wrong. (multiply by HZ not divide for example,
but there's a few dozen ways it can and does go wrong). A relative msec
based interface is a LOT harder to get wrong, and also often is closer
to what the datasheet of the hardware says. I'm not going to say "all
driver writers are stupid" because they're not; however too many of them
just act like they are too much of the time. That doesn't mean that
there is no room for a "powerful interface" next to a simple one, and I
hope you're not fully against adding a simple interface on top of a more
powerful one if that simple interface is a way to reduce mistakes and
thus bugs in drivers.
> just doesn't realize that the latter is a bit more complicated exactly
> because the latter is a hell of a lot more POWERFUL. Trying to get rid of
> jiffies for some religious reason is _stupid_.
I have nothing religious against jiffies per se. My argument however is
that with a few simple, relative interfaces *in addition* to an absolute
interface, almost all drivers suddenly are isolated from jiffies and HZ
because they simply don't care. Because they really DON'T care about
absolute time. At all.
Doing this will in turn open up flexibility in experimenting with how
one implements the timer stuff; there's suddenly a lot less code to
touch in doing so. Also such relative interface can match the intent a
lot better and separated from the actual implementation.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
|
|