Re: [RFC][PATCH] Dynamic Tick: Allow 32-bit machines to sleepformorethan2.15 seconds

From: John Stultz
Date: Fri May 15 2009 - 21:29:42 EST


On Fri, 2009-05-15 at 13:55 -0500, Jon Hunter wrote:
> Jon Hunter wrote:
> > + /*
> > + * If the result overflows, return the max value we can.
> > + */
> > + if (overflow)
> > + ret = LONG_MAX;
> > + else
> > + ret = (s64)((upper << 32) + lower);
> > +
> > return ret;
> > }
>
> Correction. Should have been LLONG_MAX and not LONG_MAX in the above.
> See below.

As I said before, I don't think we want to go this path, but as an
aside, if we did want to catch and handle overflows (which would be bad
for timekeeping as time would seemingly stop increasing, instead we
really just want to ensure they never happen), you'd not want to return
LLONG_MAX, since that would be *way* too big (500 years of nanoseconds)!

Instead you'd probably want: LLONG_MAX >> clocksource->shift

Which would better mimic the (cycles*mult) >> shift calculation.

But I think the outline I provided in my last email is the better
solution.

thanks
-john

--
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/