Messages in this thread | | | Date | Thu, 2 Mar 2006 19:48:41 -0800 | From | Andrew Morton <> | Subject | Re: [PATCH] fix potential jiffies overflow |
| |
Atsushi Nemoto <anemo@mba.ocn.ne.jp> wrote: > > >>>>> On Thu, 2 Mar 2006 18:45:02 -0800, Andrew Morton <akpm@osdl.org> said: > akpm> Thanks, that looks like 2.6.16 material. > > akpm> What happens if the machine slept for more than 49.7 days? > > Well, jiffies will lose 49.7 days... Then, how about this? We can > sleep 136 years. > > Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp> > > diff --git a/arch/i386/kernel/time.c b/arch/i386/kernel/time.c > index a14d594..be5d079 100644 > --- a/arch/i386/kernel/time.c > +++ b/arch/i386/kernel/time.c > @@ -400,7 +400,7 @@ static int timer_resume(struct sys_devic > { > unsigned long flags; > unsigned long sec; > - unsigned long sleep_length; > + u64 sleep_length; > > #ifdef CONFIG_HPET_TIMER > if (is_hpet_enabled()) > @@ -408,7 +408,7 @@ static int timer_resume(struct sys_devic > #endif > setup_pit_timer(); > sec = get_cmos_time() + clock_cmos_diff; > - sleep_length = (get_cmos_time() - sleep_start) * HZ; > + sleep_length = (u64)(get_cmos_time() - sleep_start) * HZ; > write_seqlock_irqsave(&xtime_lock, flags); > xtime.tv_sec = sec; > xtime.tv_nsec = 0;
but...
wall_jiffies += sleep_length;
wall_jiffies is 32-bit. - 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/
| |