All of lore.kernel.org
 help / color / mirror / Atom feed
From: george anzinger <george@mvista.com>
To: Andrew Morton <akpm@osdl.org>
Cc: john stultz <johnstul@us.ibm.com>,
	Albert Cahalan <albert@users.sourceforge.net>,
	linux-kernel@vger.kernel.org, Ulrich.Windl@rz.uni-regensburg.de
Subject: Re: Fw: missing #if for 1000 HZ
Date: Mon, 28 Jul 2003 14:55:51 -0700	[thread overview]
Message-ID: <3F259BE7.9070403@mvista.com> (raw)
In-Reply-To: <20030725203843.569863bc.akpm@osdl.org>

Andrew Morton wrote:
> Guys?

If I understand what is being done, he is right.  By this measure the 
current error in the div (by shifting) is 2.4%.

I wonder how this plays with(line 639):

	time_phase += time_adj;
	if (time_phase <= -FINENSEC) {
		long ltemp = -time_phase >> (SHIFT_SCALE - 10);
		time_phase += ltemp << (SHIFT_SCALE - 10);
		delta_nsec -= ltemp;
	}

where, we are also using >>10 ~= /1000.  I _think_ this ladder 
approximation only delays part of the correction but does not loose 
it, but the more eyes the better.

-g
> 
> Begin forwarded message:
> 
> Date: 22 Jul 2003 21:01:16 -0400
> From: Albert Cahalan <albert@users.sourceforge.net>
> To: linux-kernel@vger.kernel.org, Ulrich.Windl@rz.uni-regensburg.de
> Cc: Andrew Morton <akpm@digeo.com>, alan@redhat.com
> Subject: missing #if for 1000 HZ
> 
> 
> This should improve timekeeping a bit @ 1000 HZ.
> 
> 
> diff -Naurd old/kernel/timer.c new/kernel/timer.c
> --- old/kernel/timer.c	2003-07-18 17:27:01.000000000 -0400
> +++ new/kernel/timer.c	2003-07-18 17:32:19.000000000 -0400
> @@ -606,6 +606,15 @@
>      else
>  	time_adj += (time_adj >> 2) + (time_adj >> 5);
>  #endif
> +#if HZ == 1000
> +    /* Compensate for (HZ==1000) != (1 << SHIFT_HZ).
> +     * Add 1.5625% and 0.78125% to get 1023.4375; => only 0.05% error (p. 14)
> +     */
> +    if (time_adj < 0)
> +	time_adj -= (-time_adj >> 6) + (-time_adj >> 7);
> +    else
> +	time_adj += (time_adj >> 6) + (time_adj >> 7);
> +#endif
>  }
>  
>  /* in the NTP reference this is called "hardclock()" */
> 
> 
> 
> 

-- 
George Anzinger   george@mvista.com
High-res-timers:  http://sourceforge.net/projects/high-res-timers/
Preemption patch: http://www.kernel.org/pub/linux/kernel/people/rml


           reply	other threads:[~2003-07-28 21:56 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <20030725203843.569863bc.akpm@osdl.org>]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3F259BE7.9070403@mvista.com \
    --to=george@mvista.com \
    --cc=Ulrich.Windl@rz.uni-regensburg.de \
    --cc=akpm@osdl.org \
    --cc=albert@users.sourceforge.net \
    --cc=johnstul@us.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.