time: ntp: micro-optimize ntp_update_offset()
authorIngo Molnar <mingo@elte.hu>
Sun, 22 Feb 2009 12:29:09 +0000 (13:29 +0100)
committerIngo Molnar <mingo@elte.hu>
Wed, 25 Feb 2009 17:38:12 +0000 (18:38 +0100)
Impact: cleanup, no functionality changed

The time_reftime update in ntp_update_offset() to xtime.tv_sec
is a convoluted way of saying that we want to freeze the frequency
and want the 'secs' delta to be 0. Also make this branch unlikely.

This shaves off 8 bytes from the code size:

   text    data     bss     dec     hex filename
   2504     114     136    2754     ac2 ntp.o.before
   2496     114     136    2746     aba ntp.o.after

Signed-off-by: Ingo Molnar <mingo@elte.hu>
kernel/time/ntp.c

index 5202dde2f0af59d890d0ae086df77cb63c34776f..580a3502869341c42ad03301479da22a420fbd63 100644 (file)
@@ -141,10 +141,10 @@ static void ntp_update_offset(long offset)
         * Select how the frequency is to be controlled
         * and in which mode (PLL or FLL).
         */
-       if (time_status & STA_FREQHOLD || time_reftime == 0)
-               time_reftime = xtime.tv_sec;
-
        secs = xtime.tv_sec - time_reftime;
+       if (unlikely(time_status & STA_FREQHOLD || time_reftime == 0))
+               secs = 0;
+
        time_reftime = xtime.tv_sec;
 
        offset64    = offset;