• Thomas Gleixner's avatar
    timers: Fix slack calculation really · 8e63d779
    Thomas Gleixner authored
    commit f00e047e (timers: Fix slack calculation for expired timers)
    fixed the issue of slack on expired timers only partially. Linus
    noticed that jiffies is volatile so it is reloaded twice, which
    generates bad code.
    
    But its worse. This can defeat the time_after() check if jiffies are
    incremented between time_after() and the slack calculation.
    
    Fix it by reading jiffies into a local variable, which prevents the
    compiler from loading it twice. While at it make the > -1 check into
    >= 0 which is easier to read.
    Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
    Cc: Arjan van de Ven <arjan@linux.intel.com>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    8e63d779
timer.c 46.3 KB