Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge git://git.kernel.org/pub/scm/linux/kernel/git/tglx/linux-2.6-hrt

* git://git.kernel.org/pub/scm/linux/kernel/git/tglx/linux-2.6-hrt:
time: remove obsolete CLOCK_TICK_ADJUST
time: don't touch an offlined CPU's ts->tick_stopped in tick_cancel_sched_timer()
time: prevent the loop in timespec_add_ns() from being optimised away
ntp: use unsigned input for do_div()

+25 -19
+4
include/linux/time.h
··· 174 174 { 175 175 ns += a->tv_nsec; 176 176 while(unlikely(ns >= NSEC_PER_SEC)) { 177 + /* The following asm() prevents the compiler from 178 + * optimising this loop into a modulo operation. */ 179 + asm("" : "+r"(ns)); 180 + 177 181 ns -= NSEC_PER_SEC; 178 182 a->tv_sec++; 179 183 }
+1 -8
include/linux/timex.h
··· 232 232 #else 233 233 #define NTP_INTERVAL_FREQ (HZ) 234 234 #endif 235 - 236 - #define CLOCK_TICK_OVERFLOW (LATCH * HZ - CLOCK_TICK_RATE) 237 - #define CLOCK_TICK_ADJUST (((s64)CLOCK_TICK_OVERFLOW * NSEC_PER_SEC) / \ 238 - (s64)CLOCK_TICK_RATE) 239 - 240 - /* Because using NSEC_PER_SEC would be too easy */ 241 - #define NTP_INTERVAL_LENGTH ((((s64)TICK_USEC * NSEC_PER_USEC * USER_HZ) + \ 242 - CLOCK_TICK_ADJUST) / NTP_INTERVAL_FREQ) 235 + #define NTP_INTERVAL_LENGTH (NSEC_PER_SEC/NTP_INTERVAL_FREQ) 243 236 244 237 /* Returns how long ticks are at present, in ns / 2^(SHIFT_SCALE-10). */ 245 238 extern u64 current_tick_length(void);
+17 -6
kernel/time/ntp.c
··· 42 42 long time_freq; /* frequency offset (scaled ppm)*/ 43 43 static long time_reftime; /* time at last adjustment (s) */ 44 44 long time_adjust; 45 + static long ntp_tick_adj; 45 46 46 47 static void ntp_update_frequency(void) 47 48 { 48 49 u64 second_length = (u64)(tick_usec * NSEC_PER_USEC * USER_HZ) 49 50 << TICK_LENGTH_SHIFT; 50 - second_length += (s64)CLOCK_TICK_ADJUST << TICK_LENGTH_SHIFT; 51 + second_length += (s64)ntp_tick_adj << TICK_LENGTH_SHIFT; 51 52 second_length += (s64)time_freq << (TICK_LENGTH_SHIFT - SHIFT_NSEC); 52 53 53 54 tick_length_base = second_length; ··· 343 342 freq_adj = shift_right(freq_adj, time_constant * 2 + 344 343 (SHIFT_PLL + 2) * 2 - SHIFT_NSEC); 345 344 if (mtemp >= MINSEC && (time_status & STA_FLL || mtemp > MAXSEC)) { 345 + u64 utemp64; 346 346 temp64 = time_offset << (SHIFT_NSEC - SHIFT_FLL); 347 347 if (time_offset < 0) { 348 - temp64 = -temp64; 349 - do_div(temp64, mtemp); 350 - freq_adj -= temp64; 348 + utemp64 = -temp64; 349 + do_div(utemp64, mtemp); 350 + freq_adj -= utemp64; 351 351 } else { 352 - do_div(temp64, mtemp); 353 - freq_adj += temp64; 352 + utemp64 = temp64; 353 + do_div(utemp64, mtemp); 354 + freq_adj += utemp64; 354 355 } 355 356 } 356 357 freq_adj += time_freq; ··· 403 400 notify_cmos_timer(); 404 401 return(result); 405 402 } 403 + 404 + static int __init ntp_tick_adj_setup(char *str) 405 + { 406 + ntp_tick_adj = simple_strtol(str, NULL, 0); 407 + return 1; 408 + } 409 + 410 + __setup("ntp_tick_adj=", ntp_tick_adj_setup);
+1 -1
kernel/time/tick-sched.c
··· 640 640 641 641 if (ts->sched_timer.base) 642 642 hrtimer_cancel(&ts->sched_timer); 643 - ts->tick_stopped = 0; 643 + 644 644 ts->nohz_mode = NOHZ_MODE_INACTIVE; 645 645 } 646 646 #endif /* HIGH_RES_TIMERS */
+2 -4
kernel/time/timekeeping.c
··· 187 187 188 188 clock->error = 0; 189 189 clock->xtime_nsec = 0; 190 - clocksource_calculate_interval(clock, 191 - (unsigned long)(current_tick_length()>>TICK_LENGTH_SHIFT)); 190 + clocksource_calculate_interval(clock, NTP_INTERVAL_LENGTH); 192 191 193 192 tick_clock_notify(); 194 193 ··· 244 245 ntp_clear(); 245 246 246 247 clock = clocksource_get_next(); 247 - clocksource_calculate_interval(clock, 248 - (unsigned long)(current_tick_length()>>TICK_LENGTH_SHIFT)); 248 + clocksource_calculate_interval(clock, NTP_INTERVAL_LENGTH); 249 249 clock->cycle_last = clocksource_read(clock); 250 250 251 251 xtime.tv_sec = sec;