]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
time: apply NTP frequency/tick changes immediately
authorjohn stultz <johnstul@us.ibm.com>
Thu, 19 Feb 2009 00:02:22 +0000 (16:02 -0800)
committerIngo Molnar <mingo@elte.hu>
Thu, 19 Feb 2009 09:10:08 +0000 (10:10 +0100)
Since the GENERIC_TIME changes landed, the adjtimex behavior changed
for struct timex.tick and .freq changed. When the tick or freq value
is set, we adjust the tick_length_base in ntp_update_frequency().
However, this new value doesn't get applied to tick_length until the
next second (via second_overflow).

This means some applications that do quick time tweaking do not see the
requested change made as quickly as expected.

I've run a few tests with this change, and ntpd still functions fine.

Signed-off-by: John Stultz <johnstul@us.ibm.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
kernel/time/ntp.c

index f5f793d924151736d92034ea0accd37fb354eef3..e1fa3689a90316c4fe9f52424d7a2e326281a505 100644 (file)
@@ -51,6 +51,7 @@ static long ntp_tick_adj;
 
 static void ntp_update_frequency(void)
 {
+       u64 old_tick_length_base = tick_length_base;
        u64 second_length = (u64)(tick_usec * NSEC_PER_USEC * USER_HZ)
                                << NTP_SCALE_SHIFT;
        second_length += (s64)ntp_tick_adj << NTP_SCALE_SHIFT;
@@ -60,6 +61,12 @@ static void ntp_update_frequency(void)
 
        tick_nsec = div_u64(second_length, HZ) >> NTP_SCALE_SHIFT;
        tick_length_base = div_u64(tick_length_base, NTP_INTERVAL_FREQ);
+
+       /*
+        * Don't wait for the next second_overflow, apply
+        * the change to the tick length immediately
+        */
+       tick_length += tick_length_base - old_tick_length_base;
 }
 
 static void ntp_update_offset(long offset)