Re: [PATCH] next_timer_interrupt: simpler overflow handling

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Keir Fraser wrote:
Having seen the patch applied to 2.6.17 to fix the overflowing comparison in next_timer_interrupt() it occurred to me that a much simpler fix is to not set hr_expires to MAX_JIFFY_OFFSET. It's way further out from jiffies than necessary, which is why it's caused problems. I instead propose that we initialise it to LONG_MAX>>1, just as we already do for the non-hr expires variable. This will allow safe comparison with any timer value in the range jiffies+/-(LONG_MAX>>1) which is plenty of range around jiffies (+/- 12 days if HZ=1000 and long is 32 bits).

The advantages are simpler code, and uniform initialisation of expires and hr_expires variables.

Even simpler would be to just make MAX_JIFFY_OFFSET be (LONG_MAX >> 1) and use this for both. In fact, it appears it used to be, judging by the comment in jiffies.h:

* The maximum jiffie value is (MAX_INT >> 1).  Here we translate that

But seeing as this could have unanticipated side effects, I like this fix better.

Acked-By: Zachary Amsden <[email protected]>
-
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]
  Powered by Linux