diff options
author | Ingo Molnar <mingo@elte.hu> | 2009-02-22 10:03:37 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-02-25 12:38:16 -0500 |
commit | 069569e025706f27f939785f86a94d5d8ce55dce (patch) | |
tree | 49c563db54f77883dc5cd0ff1e381cf80898c0a5 /kernel/time/ntp.c | |
parent | 2b9d1496e7835a603c340e8f0dd81f4b74d5f248 (diff) |
time: ntp: simplify ntp_tick_adj calculations
Impact: micro-optimization
Convert the (internal) ntp_tick_adj value we store from unscaled
units to scaled units. This is a constant that we never modify,
so scaling it up once during bootup is enough - we dont have to
do it for every adjustment step.
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/time/ntp.c')
-rw-r--r-- | kernel/time/ntp.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/kernel/time/ntp.c b/kernel/time/ntp.c index 7447d57e021a..a3fe7ef2d83b 100644 --- a/kernel/time/ntp.c +++ b/kernel/time/ntp.c | |||
@@ -71,7 +71,8 @@ static long time_reftime; | |||
71 | 71 | ||
72 | long time_adjust; | 72 | long time_adjust; |
73 | 73 | ||
74 | static long ntp_tick_adj; | 74 | /* constant (boot-param configurable) NTP tick adjustment (upscaled) */ |
75 | static s64 ntp_tick_adj; | ||
75 | 76 | ||
76 | /* | 77 | /* |
77 | * NTP methods: | 78 | * NTP methods: |
@@ -89,7 +90,7 @@ static void ntp_update_frequency(void) | |||
89 | second_length = (u64)(tick_usec * NSEC_PER_USEC * USER_HZ) | 90 | second_length = (u64)(tick_usec * NSEC_PER_USEC * USER_HZ) |
90 | << NTP_SCALE_SHIFT; | 91 | << NTP_SCALE_SHIFT; |
91 | 92 | ||
92 | second_length += (s64)ntp_tick_adj << NTP_SCALE_SHIFT; | 93 | second_length += ntp_tick_adj; |
93 | second_length += time_freq; | 94 | second_length += time_freq; |
94 | 95 | ||
95 | tick_nsec = div_u64(second_length, HZ) >> NTP_SCALE_SHIFT; | 96 | tick_nsec = div_u64(second_length, HZ) >> NTP_SCALE_SHIFT; |
@@ -540,6 +541,8 @@ int do_adjtimex(struct timex *txc) | |||
540 | static int __init ntp_tick_adj_setup(char *str) | 541 | static int __init ntp_tick_adj_setup(char *str) |
541 | { | 542 | { |
542 | ntp_tick_adj = simple_strtol(str, NULL, 0); | 543 | ntp_tick_adj = simple_strtol(str, NULL, 0); |
544 | ntp_tick_adj <<= NTP_SCALE_SHIFT; | ||
545 | |||
543 | return 1; | 546 | return 1; |
544 | } | 547 | } |
545 | 548 | ||