Skip to content
  • John Stultz's avatar
    clocksource: Simplify the clocks_calc_max_nsecs() logic · 6086e346
    John Stultz authored
    
    
    The previous clocks_calc_max_nsecs() code had some unecessarily
    complex bit logic to find the max interval that could cause
    multiplication overflows. Since this is not in the hot
    path, just do the divide to make it easier to read.
    
    The previous implementation also had a subtle issue
    that it avoided overflows with signed 64-bit values, where
    as the intervals are always unsigned. This resulted in
    overly conservative intervals, which other safety margins
    were then added to, reducing the intended interval length.
    
    Signed-off-by: default avatarJohn Stultz <john.stultz@linaro.org>
    Cc: Dave Jones <davej@codemonkey.org.uk>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Prarit Bhargava <prarit@redhat.com>
    Cc: Richard Cochran <richardcochran@gmail.com>
    Cc: Stephen Boyd <sboyd@codeaurora.org>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Link: http://lkml.kernel.org/r/1426133800-29329-2-git-send-email-john.stultz@linaro.org
    
    
    Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
    6086e346