mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* Re: gettimeofday resolution seriously degraded in test9
@ 2003-10-28  0:29 john stultz
  2003-10-28  1:17 ` Stephen Hemminger
  0 siblings, 1 reply; 9+ messages in thread
From: john stultz @ 2003-10-28  0:29 UTC (permalink / raw)
  To: Joe Korty; +Cc: Linus Torvalds, lkml, Andrew Morton, shemminger

On Mon, 2003-10-27 at 15:44, Joe Korty wrote:
> [ 2nd posting, the first seems to have been lost ]
> 
> Linus,
>  This bit of -test9 code reduces the resolution of gettimeofday(2) from
> 1 microsecond to 1 millisecond whenever a negative time adjustment is
> in progress.  This seriously damages efforts to measure time intervals
> accurately with gettimeofday.  Please consider backing it out.
> 
> Joe
> 
> 
> diff -Nura linux-2.6.0-test8/arch/i386/kernel/time.c linux-2.6.0-test9/arch/i386/kernel/time.c
> --- linux-2.6.0-test8/arch/i386/kernel/time.c	2003-10-17 17:43:11.000000000 -0400
> +++ linux-2.6.0-test9/arch/i386/kernel/time.c	2003-10-25 14:43:37.000000000 -0400
> @@ -104,6 +104,15 @@
>  		lost = jiffies - wall_jiffies;
>  		if (lost)
>  			usec += lost * (1000000 / HZ);
> +
> +		/*
> +		 * If time_adjust is negative then NTP is slowing the clock
> +		 * so make sure not to go into next possible interval.
> +		 * Better to lose some accuracy than have time go backwards..
> +		 */
> +		if (unlikely(time_adjust < 0) && usec > tickadj)
> +			usec = tickadj;
> +
>  		sec = xtime.tv_sec;
>  		usec += (xtime.tv_nsec / 1000);
>  	} while (read_seqretry(&xtime_lock, seq));
> 

Hmm. This is the stair-step effect of capping time for NTP adjustments.
The side effect was expected, but I didn't figure it would be so drastic
as NTP adjustments are supposedly limited to 10%. Do you not see time
inconsistencies when running without this patch?

Stephen, any thoughts?  

thanks
-john



^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2003-11-28  1:29 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <LphK.2Dl.15@gated-at.bofh.it>
     [not found] ` <Lq47.3Go.11@gated-at.bofh.it>
     [not found]   ` <LqGL.4zF.11@gated-at.bofh.it>
     [not found]     ` <LAPN.1dU.11@gated-at.bofh.it>
     [not found]       ` <LGLz.1h2.5@gated-at.bofh.it>
2003-10-28 19:19         ` gettimeofday resolution seriously degraded in test9 David Mosberger-Tang
2003-10-28 19:59           ` Stephen Hemminger
2003-10-29  0:19             ` David Mosberger
     [not found]         ` <LVAR.4Mb.3@gated-at.bofh.it>
     [not found]           ` <M4uv.bw.5@gated-at.bofh.it>
     [not found]             ` <M7sx.4et.13@gated-at.bofh.it>
     [not found]               ` <MsGE.8cN.19@gated-at.bofh.it>
     [not found]                 ` <MsZZ.c3.5@gated-at.bofh.it>
     [not found]                   ` <Mufp.1YL.15@gated-at.bofh.it>
     [not found]                     ` <VOyG.w9.35@gated-at.bofh.it>
2003-11-28  1:29                       ` [RFC] possible erronous use of tick_usec in do_gettimeofday Andi Kleen
2003-10-28  0:29 gettimeofday resolution seriously degraded in test9 john stultz
2003-10-28  1:17 ` Stephen Hemminger
2003-10-28 11:55   ` Gabriel Paubert
2003-10-28 18:21     ` Stephen Hemminger
2003-10-29 10:07       ` Gabriel Paubert
2003-10-29 19:38         ` Stephen Hemminger
2003-10-29 22:50           ` Peter Chubb
2003-10-30 21:33             ` George Anzinger
2003-10-30 21:52               ` Richard B. Johnson
2003-10-30 23:15                 ` Peter Chubb
2003-11-25 16:42                   ` [RFC] possible erronous use of tick_usec in do_gettimeofday Joe Korty
2003-11-25 17:13                     ` Stephen Hemminger
2003-11-25 19:57                     ` George Anzinger
2003-11-25 21:12                       ` Joe Korty
2003-11-25 23:26                         ` George Anzinger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome