Patch "time: Fix timekeeping_freqadjust()'s incorrect use of abs() instead of abs64()" has been added to the 4.2-stable tree
Subsystems (2)
This is a note to let you know that I've just added the patch titled
time: Fix timekeeping_freqadjust()'s incorrect use of abs() instead of abs64()
to the 4.2-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
time-fix-timekeeping_freqadjust-s-incorrect-use-of-abs-instead-of-abs64.patch
and it can be found in the queue-4.2 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
Quoted 1 line
From
2619d7e9c92d524cb155ec89fd72875321512e5bMon Sep 17 00:00:00 2001
From: John Stultz <[email protected]>
Date: Wed, 9 Sep 2015 16:07:30 -0700
Subject: time: Fix timekeeping_freqadjust()'s incorrect use of abs() instead of abs64()
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
From: John Stultz <[email protected]>
commit 2619d7e9c92d524cb155ec89fd72875321512e5b upstream.
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:
dc491596f639 ("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.
--- kernel/time/timekeeping.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/time/timekeeping.c +1 -1
@@ -1607,7 +1607,7 @@ static __always_inline void timekeeping_ negative = (tick_error <0 );/* Sort out the magnitude of the correction */ - tick_error =abs (tick_error); + tick_error =abs64 (tick_error);for (adj =0 ; tick_error > interval; adj++) tick_error >>=1 ;
Patches currently in stable-queue which might be from [email protected] are
queue-4.2/time-fix-timekeeping_freqadjust-s-incorrect-use-of-abs-instead-of-abs64.patch