Skip to content

Commit

Permalink
time: ntp: micro-optimize ntp_update_offset()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Ingo Molnar committed Feb 25, 2009
1 parent 478b7aa commit c7986ac
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions kernel/time/ntp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit c7986ac

Please sign in to comment.