Yep, this is one of those bugs. IMHO, the kernel should
continue operating normally on 32-bit-int machines, even
if user programs that format stuff in ASCII get confused.
As a general principle, code that looks like this
if (time > threshold)
should be shot if there's any chance of wraparound, ever.
It's better to use an idiom like
if (((long)(time - threshold)) > 0)
which simply keeps on working in the face of wraparound.
The kernel provides nice macros for this already in timer.h:
* These inlines deal with timer wrapping correctly. You are
* strongly encouraged to use them
* 1. Because people otherwise forget
* 2. Because if the timer wrap changes in future you wont have to
* alter your driver code. ...
*/
#define time_after(a,b) ((long)(b) - (long)(a) < 0)
I suspect there aren't too places in the kernel that
screw up and don't use these macros; it would be nice
to clean them all up, as a matter of principle. It won't
bloat the kernel at all, and it brings it one step
closer to making 100 year uptimes possible.
- Dan
-- (The above is just my personal opinion; I don't speak for my employer, except on the occasional talk show.)- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/