On Wed, 2006-07-26 at 17:16 +0200, Andi Kleen wrote:
> Neil Horman <[email protected]> writes:
>
> > At OLS last week, During Dave Jones Userspace Sucks presentation, Jim
> > Geddys and some of the Xorg guys noted that they would be able to stop using gettimeofday
> > so frequently, if they had some other way to get a millisecond resolution timer
> > in userspace,
I agree with Andi here.
>
> No, no, it's wrong. They should use gettimeofday and the kernel's job
> is to make it fast enough that they can.
Exactly. On modern machines, doing a procedure call to get the time (as
opposed to a system trap) is, I suspect, very tolerable. And who knows,
maybe a smart compiler inlines the procedure so it optimizes to just a
few instructions.
If behind the scenes there is a mapped page that is used to convey this
information efficiently, that's fine.
But I don't think it should be the application programmer's
responsibility to know of hackish solutions of mmapping particular
devices on particular OS hardware or software platforms. That's a
symptom of the disease, rather than a clean solution.
>
> Or rather they likely shouldn't use gettimeofday, but clock_gettime()
> with CLOCK_MONOTONIC instead to be independent of someone setting the
> clock back.
Turns out we already have code to handle the turn back case, but
monotonically increasing time is generally appreciated ;-).
>
> Memory mapped counters are generally not flexible enough and there
> are lots of reasons why the kernel might need to do special things
> for time keeping. Don't expose them.
Yup. I agree entirely.
>
> -Andi
--
Jim Gettys
One Laptop Per Child
-
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]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]