Re: fluctuations in /proc/stat btime field

From: Kingsley Cheung (kingsley@aurema.com)
Date: Wed Mar 19 2003 - 20:47:55 EST


On Wed, Mar 19, 2003 at 03:45:54PM +1100, Kingsley Cheung wrote:
> Hi,
>
> On a dual SMP box running SuSE-2.4.19-79 (United Linux rc4), the boot
> time in /proc/stat can vary 1 second when read. I haven't seen this
> on a UP box. Its not a major issue, but I guess its a hindrance if
> one's expecting it to never change:
>
> gen2 12:06:52 ~: grep btime /proc/stat
> btime 1046838984
> gen2 12:07:06 ~: grep btime /proc/stat
> btime 1046838984
> gen2 12:07:07 ~: grep btime /proc/stat
> btime 1046838983
> gen2 12:07:07 ~: grep btime /proc/stat
> btime 1046838983
> gen2 12:07:08 ~: grep btime /proc/stat
> btime 1046838983
> gen2 12:07:09 ~: grep btime /proc/stat
> btime 1046838984
> gen2 12:07:10 ~: grep btime /proc/stat
> btime 1046838984
> gen2 12:07:11 ~: grep btime /proc/stat
> btime 1046838983
>
> I'm not familiar with the way IO-APIC timers work or the interrupt
> timer itself, so can someone explain why this is the case? I'm
> guessing that it might simply be a timing issue between when the
> actual interrupt handling updating jiffies in do_timer and the bottom
> half updating xtime.tv_sec (see kernel/timer.c).
>
> Maybe by caching the btime value so that its only calculated once is
> the way to go. Attached is the suggested fix, as well as the output
> from /proc/cpuinfo & /proc/interrupts.
>
> If someone could get back to me on this it would be much appreciated.
>

Actually, correction: the boot-time does also fluctuate on a UP as
well. Not nice if you want absolute boot-time.

-- 
		Kingsley
-
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 : Sun Mar 23 2003 - 22:00:29 EST