public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: zippel@linux-m68k.org
To: Andrew Morton <akpm@osdl.org>
Cc: linux-kernel@vger.kernel.org, john stultz <johnstul@us.ibm.com>
Subject: [NTP 2/9] add time_adj to tick length
Date: Thu, 10 Aug 2006 02:01:48 +0200	[thread overview]
Message-ID: <20060810001113.881368000@linux-m68k.org> (raw)
In-Reply-To: 20060810000146.913645000@linux-m68k.org

[-- Attachment #1: 0002-NTP-add-time_adj-to-tick-length.txt --]
[-- Type: text/plain, Size: 1658 bytes --]

This makes time_adj local to second_overflow() and integrates it into
the tick length instead of adding it everytime.

Signed-off-by: Roman Zippel <zippel@linux-m68k.org>
---
 kernel/time/ntp.c |    6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

Index: linux-2.6-mm/kernel/time/ntp.c
===================================================================
--- linux-2.6-mm.orig/kernel/time/ntp.c
+++ linux-2.6-mm/kernel/time/ntp.c
@@ -45,7 +45,6 @@ long time_maxerror = NTP_PHASE_LIMIT;	/*
 long time_esterror = NTP_PHASE_LIMIT;	/* estimated error (us)		*/
 long time_freq = (((NSEC_PER_SEC + HZ/2) % HZ - HZ/2) << SHIFT_USEC) / NSEC_PER_USEC;
 					/* frequency offset (scaled ppm)*/
-static long time_adj;			/* tick adjust (scaled 1 / HZ)	*/
 long time_reftime;			/* time at last adjustment (s)	*/
 long time_adjust;
 long time_next_adjust;
@@ -90,7 +89,7 @@ void ntp_update_frequency(void)
  */
 void second_overflow(void)
 {
-	long ltemp;
+	long ltemp, time_adj;
 
 	/* Bump the maxerror field */
 	time_maxerror += time_tolerance >> SHIFT_USEC;
@@ -195,6 +194,7 @@ void second_overflow(void)
 	time_adj += shift_right(time_adj, 6) + shift_right(time_adj, 7);
 #endif
 	tick_length = tick_length_base;
+	tick_length += (s64)time_adj << (TICK_LENGTH_SHIFT - (SHIFT_SCALE - 10));
 }
 
 /*
@@ -251,11 +251,9 @@ u64 current_tick_length(void)
 	u64 ret;
 
 	/* calculate the finest interval NTP will allow.
-	 *    ie: nanosecond value shifted by (SHIFT_SCALE - 10)
 	 */
 	ret = tick_length;
 	ret += (u64)(adjtime_adjustment() * 1000) << TICK_LENGTH_SHIFT;
-	ret += (s64)time_adj << (TICK_LENGTH_SHIFT - (SHIFT_SCALE - 10));
 
 	return ret;
 }

--


  parent reply	other threads:[~2006-08-10  0:14 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-10  0:01 [NTP 0/9] NTP patches zippel
2006-08-10  0:01 ` [NTP 1/9] add ntp_update_frequency zippel
2006-08-10  0:01 ` zippel [this message]
2006-08-10  0:01 ` [NTP 3/9] add time_freq to tick length zippel
2006-08-10  0:01 ` [NTP 4/9] prescale time_offset zippel
2006-08-10  0:01 ` [NTP 5/9] add time_adjust to tick length zippel
2006-08-20 15:33   ` Atsushi Nemoto
2006-08-20 17:25     ` Roman Zippel
2006-08-10  0:01 ` [NTP 6/9] remove time_tolerance zippel
2006-08-10  0:01 ` [NTP 7/9] convert time_freq to nsec value zippel
2006-08-10  0:01 ` [NTP 8/9] convert to the NTP4 reference model zippel
2006-08-10 18:49   ` Andrew Morton
2006-08-10 19:14     ` Roman Zippel
2006-08-10 19:29       ` Andrew Morton
2006-08-10 19:59         ` Roman Zippel
2006-08-10  0:01 ` [NTP 9/9] cleanup defines and comments zippel
2006-08-16 23:07 ` [NTP 0/9] NTP patches john stultz
2006-08-17 10:32   ` Roman Zippel

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=20060810001113.881368000@linux-m68k.org \
    --to=zippel@linux-m68k.org \
    --cc=akpm@osdl.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox