summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorMichal Nazarewicz <mina86@mina86.com>2015-11-09 14:58:10 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2015-11-09 15:11:24 -0800
commitc8299cb605b27dd5a49f7a69e48fd23e5a206298 (patch)
treedf0ba995298d9d7210bd734c9edbed4801b07ab5 /fs
parent9c2d5eebfe3421a31499b552800041e684639076 (diff)
downloadop-kernel-dev-c8299cb605b27dd5a49f7a69e48fd23e5a206298.zip
op-kernel-dev-c8299cb605b27dd5a49f7a69e48fd23e5a206298.tar.gz
kernel.h: make abs() work with 64-bit types
For 64-bit arguments, the abs macro casts it to an int which leads to lost precision and may cause incorrect results. To deal with 64-bit types abs64 macro has been introduced but still there are places where abs macro is used incorrectly. To deal with the problem, expand abs macro such that it operates on s64 type when dealing with 64-bit types while still returning long when dealing with smaller types. This fixes one known bug (per John): 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 : dc491596f639438 (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). Signed-off-by: Michal Nazarewicz <mina86@mina86.com> Reported-by: John Stultz <john.stultz@linaro.org> Tested-by: John Stultz <john.stultz@linaro.org> Cc: Ingo Molnar <mingo@kernel.org> Cc: Steven Rostedt <rostedt@goodmis.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs')
0 files changed, 0 insertions, 0 deletions
OpenPOWER on IntegriCloud