diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2014-07-16 21:05:15 +0000 |
---|---|---|
committer | John Stultz <john.stultz@linaro.org> | 2014-07-23 15:01:52 -0700 |
commit | 6d3aadf3e180e09dbefab16478c6876b584ce16e (patch) | |
tree | 872068009c7a8fa99a2b5abc11e7b2aa847d4801 /include/linux/timekeeper_internal.h | |
parent | 4a0e637738f06673725792d74eed67f8779b62c7 (diff) | |
download | lwn-6d3aadf3e180e09dbefab16478c6876b584ce16e.tar.gz lwn-6d3aadf3e180e09dbefab16478c6876b584ce16e.zip |
timekeeping: Restructure the timekeeper some more
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: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Diffstat (limited to 'include/linux/timekeeper_internal.h')
-rw-r--r-- | include/linux/timekeeper_internal.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/include/linux/timekeeper_internal.h b/include/linux/timekeeper_internal.h index cb88096222c0..75bb8add78f5 100644 --- a/include/linux/timekeeper_internal.h +++ b/include/linux/timekeeper_internal.h @@ -29,6 +29,10 @@ struct timekeeper { /* Current clocksource used for timekeeping. */ struct clocksource *clock; + /* Read function of @clock */ + cycle_t (*read)(struct clocksource *cs); + /* Bitmask for two's complement subtraction of non 64bit counters */ + cycle_t mask; /* Last cycle value */ cycle_t cycle_last; /* NTP adjusted clock multiplier */ |