• A
    hrtimer: Store running timer in hrtimer_clock_base · 3f0b9e8e
    Anna-Maria Gleixner 提交于
    The pointer to the currently running timer is stored in hrtimer_cpu_base
    before the base lock is dropped and the callback is invoked.
    
    This results in two levels of indirections and the upcoming support for
    softirq based hrtimer requires splitting the "running" storage into soft
    and hard IRQ context expiry.
    
    Storing both in the cpu base would require conditionals in all code paths
    accessing that information.
    
    It's possible to have a per clock base sequence count and running pointer
    without changing the semantics of the related mechanisms because the timer
    base pointer cannot be changed while a timer is running the callback.
    
    Unfortunately this makes cpu_clock base larger than 32 bytes on 32-bit
    kernels. Instead of having huge gaps due to alignment, remove the alignment
    and let the compiler pack CPU base for 32-bit kernels. The resulting cache access
    patterns are fortunately not really different from the current
    behaviour. On 64-bit kernels the 64-byte alignment stays and the behaviour is
    unchanged. This was determined by analyzing the resulting layout and
    looking at the number of cache lines involved for the frequently used
    clocks.
    Signed-off-by: NAnna-Maria Gleixner <anna-maria@linutronix.de>
    Cc: Christoph Hellwig <hch@lst.de>
    Cc: John Stultz <john.stultz@linaro.org>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Cc: keescook@chromium.org
    Link: http://lkml.kernel.org/r/20171221104205.7269-12-anna-maria@linutronix.deSigned-off-by: NIngo Molnar <mingo@kernel.org>
    3f0b9e8e
hrtimer.h 13.7 KB