linux/kernel/time
John Stultz 2619d7e9c9 time: Fix timekeeping_freqadjust()'s incorrect use of abs() instead of abs64()
The internal clocksteering done for fine-grained error
correction uses a logarithmic approximation, so any time
adjtimex() adjusts the clock steering, timekeeping_freqadjust()
quickly approximates the correct clock frequency over a series
of ticks.

Unfortunately, the logic in timekeeping_freqadjust(), introduced
in commit:

  dc491596f6 ("timekeeping: Rework frequency adjustments to work better w/ nohz")

used the abs() function with a s64 error value to calculate the
size of the approximated adjustment to be made.

Per include/linux/kernel.h:

  "abs() should not be used for 64-bit types (s64, u64, long long) - use abs64()".

Thus on 32-bit platforms, this resulted in the clocksteering to
take a quite dampended random walk trying to converge on the
proper frequency, which caused the adjustments to be made much
slower then intended (most easily observed when large
adjustments are made).

This patch fixes the issue by using abs64() instead.

Reported-by: Nuno Gonçalves <nunojpg@gmail.com>
Tested-by: Nuno Goncalves <nunojpg@gmail.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Cc: <stable@vger.kernel.org> # v3.17+
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Miroslav Lichvar <mlichvar@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Prarit Bhargava <prarit@redhat.com>
Cc: Richard Cochran <richardcochran@gmail.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/1441840051-20244-1-git-send-email-john.stultz@linaro.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
2015-09-13 10:30:47 +02:00
..
alarmtimer.c
clockevents.c clockevents: Allow set-state callbacks to be optional 2015-07-07 10:44:45 +02:00
clocksource.c
hrtimer.c hrtimer: Handle failure of tick_init_highres() gracefully 2015-08-22 10:57:50 +02:00
itimer.c
jiffies.c
Kconfig rcu: Drop RCU_USER_QS in favor of NO_HZ_FULL 2015-07-06 13:52:18 -07:00
Makefile
ntp.c time: Add the common weak version of update_persistent_clock() 2015-08-17 11:25:16 -07:00
ntp_internal.h
posix-clock.c
posix-cpu-timers.c
posix-timers.c
sched_clock.c
test_udelay.c
tick-broadcast-hrtimer.c kernel: broadcast-hrtimer: Migrate to new 'set-state' interface 2015-08-10 11:41:08 +02:00
tick-broadcast.c tick: Move the export of tick_broadcast_oneshot_control to the proper place 2015-07-14 12:01:04 +02:00
tick-common.c clockevents: Drop redundant cpumask check in tick_check_new_device() 2015-08-01 12:00:13 +02:00
tick-internal.h
tick-oneshot.c
tick-sched.c nohz: Remove useless argument on tick_nohz_task_switch() 2015-07-29 15:45:01 +02:00
tick-sched.h tick/broadcast: Make idle check independent from mode and config 2015-07-07 18:46:47 +02:00
time.c Merge branch 'timers-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2015-09-01 14:04:50 -07:00
timeconst.bc
timeconv.c
timecounter.c
timekeeping.c time: Fix timekeeping_freqadjust()'s incorrect use of abs() instead of abs64() 2015-09-13 10:30:47 +02:00
timekeeping.h
timekeeping_debug.c
timekeeping_internal.h
timer.c timer: Write timer->flags atomically 2015-08-18 15:31:16 +02:00
timer_list.c timer_list: Add the base offset so remaining nsecs are accurate for non monotonic timers 2015-08-17 11:23:31 -07:00
timer_stats.c