Re: [Patch] Re: Nasty suprise with uptime

From: Richard B. Johnson (root@chaos.analogic.com)
Date: Wed Oct 31 2001 - 14:52:04 EST


On Wed, 31 Oct 2001, Tim Schmielau wrote:

> > > I would say that the race is so rare that it should not be handled,
> > > especially since it adds extra code in the timer interrupt.
> >
>
> The expensive code in the timer interupt will be executed every
> 497.1 days, so that's bearable.

The expensive code in the timer interrupt will be executed every
timer interrupt! There is no magic way to connect two 32-bit long-words
to make a 64-bit object, no matter how well it's hidden by the 'C'
compiler. An increment of the low long-word won't magically bump the
high long-word. This takes code, and the simplist code to do it was
shown. This:
        adcl $1,(jiffies) # INCL won't set CY 4 clocks
        adcl $0,(jiffies_hi) # 4 clocks
... takes 8 clocks.
        This:
        incl (jiffies)
... takes 2 clocks

Also gcc isn't as "kind" as this. It generates volumes of strange
code to bump a 'long long'.

That's 6 extra clocks every Hz or 600 clocks per second. By the time
you've reached the 497.1 days, you have wasted.... 0xffffffff/6 =
715,827,882 CPU clocks just so 'uptime' is correct? I don't think
so. I'd reboot.

Cheers,
Dick Johnson

Penguin : Linux version 2.4.1 on an i686 machine (799.53 BogoMips).

    I was going to compile a list of innovations that could be
    attributed to Microsoft. Once I realized that Ctrl-Alt-Del
    was handled in the BIOS, I found that there aren't any.

-
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/



This archive was generated by hypermail 2b29 : Wed Oct 31 2001 - 21:00:45 EST