• Thomas Gleixner's avatar
    timekeeping: Restructure the timekeeper some more · 6d3aadf3
    Thomas Gleixner authored
    Access to time requires to touch two cachelines at minimum
    
       1) The timekeeper data structure
    
       2) The clocksource data structure
    
    The access to the clocksource data structure can be avoided as almost
    all clocksource implementations ignore the argument to the read
    callback, which is a pointer to the clocksource.
    
    But the core needs to touch it to access the members @read and @mask.
    
    So we are better off by copying the @read function pointer and the
    @mask from the clocksource to the core data structure itself.
    
    For the most used ktime_get() access all required data including the
    @read and @mask copies fits together with the sequence counter into a
    single 64 byte cacheline.
    
    For the other time access functions we touch in the current code three
    cache lines in the worst case. But with the clocksource data copies we
    can reduce that to two adjacent cachelines, which is more efficient
    than disjunct cache lines.
    Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
    Signed-off-by: default avatarJohn Stultz <john.stultz@linaro.org>
    6d3aadf3
timekeeping.c 44.9 KB