[PATCH] next_timer_interrupt: simpler overflow handling

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

 



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.
 -- Keir

Replace a fix for a comparison overflow in next_timer_interrupt() with a simpler alternative. We can be sure that the interesting range of timer values around jiffies is safe to compare with jiffies+(LONG_MAX>>1), unlike jiffies+MAX_JIFFY_OFFSET.
Signed-off-by: Keir Fraser <keir@xensource.com>

Attachment: fix-next-timer-interrupt.patch
Description: Binary data


[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