lkml.org 
[lkml]   [2006]   [Jul]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] next_timer_interrupt: simpler overflow handling
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 <zach@vmware.com>
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2006-07-13 19:05    [W:0.154 / U:0.084 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site