diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2015-04-14 17:08:44 -0400 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2015-04-22 11:06:49 -0400 |
commit | b8e38413ac2c33c497e72895fcd5da709fd1b908 (patch) | |
tree | c2aab305af3fc45fe82b9639ce8af1fa8a72f9d1 /include/linux/hrtimer.h | |
parent | 6d9a1411393d51f17bee3fe163430b21b2cb2de9 (diff) |
hrtimer: Align the hrtimer clock bases as well
We don't use cacheline_align here because that might waste lot of
space on 32bit machine with 64 bytes cachelines and on 64bit machines
with 128 bytes cachelines.
The size of struct hrtimer_clock_base is 64byte on 64bit and 32byte on
32bit machines. So we utilize the cache lines proper.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Peter Zijlstra <peterz@infradead.org>
Cc: Preeti U Murthy <preeti@linux.vnet.ibm.com>
Cc: Viresh Kumar <viresh.kumar@linaro.org>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Link: http://lkml.kernel.org/r/20150414203501.498165771@linutronix.de
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'include/linux/hrtimer.h')
-rw-r--r-- | include/linux/hrtimer.h | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h index 0853f52f8ffb..e5c22d611850 100644 --- a/include/linux/hrtimer.h +++ b/include/linux/hrtimer.h | |||
@@ -130,6 +130,12 @@ struct hrtimer_sleeper { | |||
130 | struct task_struct *task; | 130 | struct task_struct *task; |
131 | }; | 131 | }; |
132 | 132 | ||
133 | #ifdef CONFIG_64BIT | ||
134 | # define HRTIMER_CLOCK_BASE_ALIGN 64 | ||
135 | #else | ||
136 | # define HRTIMER_CLOCK_BASE_ALIGN 32 | ||
137 | #endif | ||
138 | |||
133 | /** | 139 | /** |
134 | * struct hrtimer_clock_base - the timer base for a specific clock | 140 | * struct hrtimer_clock_base - the timer base for a specific clock |
135 | * @cpu_base: per cpu clock base | 141 | * @cpu_base: per cpu clock base |
@@ -147,7 +153,7 @@ struct hrtimer_clock_base { | |||
147 | struct timerqueue_head active; | 153 | struct timerqueue_head active; |
148 | ktime_t (*get_time)(void); | 154 | ktime_t (*get_time)(void); |
149 | ktime_t offset; | 155 | ktime_t offset; |
150 | }; | 156 | } __attribute__((__aligned__(HRTIMER_CLOCK_BASE_ALIGN))); |
151 | 157 | ||
152 | enum hrtimer_base_type { | 158 | enum hrtimer_base_type { |
153 | HRTIMER_BASE_MONOTONIC, | 159 | HRTIMER_BASE_MONOTONIC, |
@@ -195,6 +201,8 @@ struct hrtimer_cpu_base { | |||
195 | 201 | ||
196 | static inline void hrtimer_set_expires(struct hrtimer *timer, ktime_t time) | 202 | static inline void hrtimer_set_expires(struct hrtimer *timer, ktime_t time) |
197 | { | 203 | { |
204 | BUILD_BUG_ON(sizeof(struct hrtimer_clock_base) > HRTIMER_CLOCK_BASE_ALIGN); | ||
205 | |||
198 | timer->node.expires = time; | 206 | timer->node.expires = time; |
199 | timer->_softexpires = time; | 207 | timer->_softexpires = time; |
200 | } | 208 | } |