lkml.org 
[lkml]   [2006]   [Feb]   [21]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
DateMon, 20 Feb 2006 23:21:40 -0700
Fromjohn stultz <>
Subject[-mm PATCH 6/11] Time: generic timekeeping infrastructure - fix ntp_synced
Call ntp_synced() is frequently enough. This fixes a potential bug where 
when ntp_synced is called, it isn't close enough to the second boundery 
(which is tested inside ntp_synced()). Without this its possible that since 
we only called it once a second, it would never sync the persistent clock.

Signed-off-by: John Stultz <johnstul@us.ibm.com>

 kernel/time/timeofday.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
Index: mm-merge/kernel/time/timeofday.c
===================================================================
--- mm-merge.orig/kernel/time/timeofday.c
+++ mm-merge/kernel/time/timeofday.c
@@ -534,7 +534,7 @@ static void timeofday_periodic_hook(unsi
 	/* advance the ntp state machine by ns interval: */
 	ntp_advance(delta_nsec);
 
-	/* only call ntp_leapsecond and ntp_sync once a sec:  */
+	/* only call ntp_leapsecond once a sec:  */
 	second_check += delta_nsec;
 	if (second_check >= NSEC_PER_SEC) {
 		/* do ntp leap second processing: */
@@ -545,11 +545,11 @@ static void timeofday_periodic_hook(unsi
 			wall_time_ts.tv_sec += leapsecond;
 			monotonic_time_offset_ts.tv_sec += leapsecond;
 		}
-		/* sync the persistent clock: */
-		if (ntp_synced())
-			sync_persistent_clock(wall_time_ts);
 		second_check -= NSEC_PER_SEC;
 	}
+	/* sync the persistent clock: */
+	if (ntp_synced())
+		sync_persistent_clock(wall_time_ts);
 
 	/* if necessary, switch clocksources: */
 	next = get_next_clocksource();
-
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/
\
 
 \ /
  Last update: 2006-02-21 06:25    [from the cache]
©2003-2008