Re: Why do we still have 32 bit counters? Interrupt counters overflow within 50 days

From: Paul Bolle
Date: Fri Oct 03 2014 - 08:15:24 EST


On Fri, 2014-10-03 at 06:54 -0500, Christoph Lameter wrote:
> On Fri, 3 Oct 2014, Thomas Gleixner wrote:
>
> > > Is this the way its intended or should the counters be expanded to 64 bit?
> >
> > There is no reason why we cannot or should not expand them.
>
> Ok here is a patch to do just that:
>
>
> Subject: Increase irq counters to 64 bit
>
>
> Irq counters can overflow easily if they are just 32 bit.
>
> For example the timer interrupt occurs 1000 times per second, so
> it is predictable that the timer interrupt will overflow in
>
>
> 2^ 32 / 1000 [interrupts per second] / 86400 [seconds in a day]
>
> which results in 46 days.

dc -e "1 k 2 32 ^ 1000 / 86400 / p"
49.7

(That was the number I remembered from stories about a ancient Windows
lockup.)

> Other irq counters for devices may wrap even faster for example
> those for high speed networking devices.
>
> This patch is needed to avoid the counter overflow by increasing
> the counters to 64 bit.
>
> Signed-off-by: Christoph Lameter <cl@xxxxxxxxx>


Paul Bolle


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/