aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/hrtimer.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/hrtimer.h')
-rw-r--r--include/linux/hrtimer.h34
1 files changed, 15 insertions, 19 deletions
diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h
index fd0c1b857d3d..f376ddc64c4d 100644
--- a/include/linux/hrtimer.h
+++ b/include/linux/hrtimer.h
@@ -22,7 +22,7 @@
22#include <linux/wait.h> 22#include <linux/wait.h>
23#include <linux/percpu.h> 23#include <linux/percpu.h>
24#include <linux/timer.h> 24#include <linux/timer.h>
25 25#include <linux/timerqueue.h>
26 26
27struct hrtimer_clock_base; 27struct hrtimer_clock_base;
28struct hrtimer_cpu_base; 28struct hrtimer_cpu_base;
@@ -79,8 +79,8 @@ enum hrtimer_restart {
79 79
80/** 80/**
81 * struct hrtimer - the basic hrtimer structure 81 * struct hrtimer - the basic hrtimer structure
82 * @node: red black tree node for time ordered insertion 82 * @node: timerqueue node, which also manages node.expires,
83 * @_expires: the absolute expiry time in the hrtimers internal 83 * the absolute expiry time in the hrtimers internal
84 * representation. The time is related to the clock on 84 * representation. The time is related to the clock on
85 * which the timer is based. Is setup by adding 85 * which the timer is based. Is setup by adding
86 * slack to the _softexpires value. For non range timers 86 * slack to the _softexpires value. For non range timers
@@ -101,8 +101,7 @@ enum hrtimer_restart {
101 * The hrtimer structure must be initialized by hrtimer_init() 101 * The hrtimer structure must be initialized by hrtimer_init()
102 */ 102 */
103struct hrtimer { 103struct hrtimer {
104 struct rb_node node; 104 struct timerqueue_node node;
105 ktime_t _expires;
106 ktime_t _softexpires; 105 ktime_t _softexpires;
107 enum hrtimer_restart (*function)(struct hrtimer *); 106 enum hrtimer_restart (*function)(struct hrtimer *);
108 struct hrtimer_clock_base *base; 107 struct hrtimer_clock_base *base;
@@ -132,7 +131,6 @@ struct hrtimer_sleeper {
132 * @index: clock type index for per_cpu support when moving a 131 * @index: clock type index for per_cpu support when moving a
133 * timer to a base on another cpu. 132 * timer to a base on another cpu.
134 * @active: red black tree root node for the active timers 133 * @active: red black tree root node for the active timers
135 * @first: pointer to the timer node which expires first
136 * @resolution: the resolution of the clock, in nanoseconds 134 * @resolution: the resolution of the clock, in nanoseconds
137 * @get_time: function to retrieve the current time of the clock 135 * @get_time: function to retrieve the current time of the clock
138 * @softirq_time: the time when running the hrtimer queue in the softirq 136 * @softirq_time: the time when running the hrtimer queue in the softirq
@@ -141,8 +139,7 @@ struct hrtimer_sleeper {
141struct hrtimer_clock_base { 139struct hrtimer_clock_base {
142 struct hrtimer_cpu_base *cpu_base; 140 struct hrtimer_cpu_base *cpu_base;
143 clockid_t index; 141 clockid_t index;
144 struct rb_root active; 142 struct timerqueue_head active;
145 struct rb_node *first;
146 ktime_t resolution; 143 ktime_t resolution;
147 ktime_t (*get_time)(void); 144 ktime_t (*get_time)(void);
148 ktime_t softirq_time; 145 ktime_t softirq_time;
@@ -158,7 +155,6 @@ struct hrtimer_clock_base {
158 * @lock: lock protecting the base and associated clock bases 155 * @lock: lock protecting the base and associated clock bases
159 * and timers 156 * and timers
160 * @clock_base: array of clock bases for this cpu 157 * @clock_base: array of clock bases for this cpu
161 * @curr_timer: the timer which is executing a callback right now
162 * @expires_next: absolute time of the next event which was scheduled 158 * @expires_next: absolute time of the next event which was scheduled
163 * via clock_set_next_event() 159 * via clock_set_next_event()
164 * @hres_active: State of high resolution mode 160 * @hres_active: State of high resolution mode
@@ -184,43 +180,43 @@ struct hrtimer_cpu_base {
184 180
185static inline void hrtimer_set_expires(struct hrtimer *timer, ktime_t time) 181static inline void hrtimer_set_expires(struct hrtimer *timer, ktime_t time)
186{ 182{
187 timer->_expires = time; 183 timer->node.expires = time;
188 timer->_softexpires = time; 184 timer->_softexpires = time;
189} 185}
190 186
191static inline void hrtimer_set_expires_range(struct hrtimer *timer, ktime_t time, ktime_t delta) 187static inline void hrtimer_set_expires_range(struct hrtimer *timer, ktime_t time, ktime_t delta)
192{ 188{
193 timer->_softexpires = time; 189 timer->_softexpires = time;
194 timer->_expires = ktime_add_safe(time, delta); 190 timer->node.expires = ktime_add_safe(time, delta);
195} 191}
196 192
197static inline void hrtimer_set_expires_range_ns(struct hrtimer *timer, ktime_t time, unsigned long delta) 193static inline void hrtimer_set_expires_range_ns(struct hrtimer *timer, ktime_t time, unsigned long delta)
198{ 194{
199 timer->_softexpires = time; 195 timer->_softexpires = time;
200 timer->_expires = ktime_add_safe(time, ns_to_ktime(delta)); 196 timer->node.expires = ktime_add_safe(time, ns_to_ktime(delta));
201} 197}
202 198
203static inline void hrtimer_set_expires_tv64(struct hrtimer *timer, s64 tv64) 199static inline void hrtimer_set_expires_tv64(struct hrtimer *timer, s64 tv64)
204{ 200{
205 timer->_expires.tv64 = tv64; 201 timer->node.expires.tv64 = tv64;
206 timer->_softexpires.tv64 = tv64; 202 timer->_softexpires.tv64 = tv64;
207} 203}
208 204
209static inline void hrtimer_add_expires(struct hrtimer *timer, ktime_t time) 205static inline void hrtimer_add_expires(struct hrtimer *timer, ktime_t time)
210{ 206{
211 timer->_expires = ktime_add_safe(timer->_expires, time); 207 timer->node.expires = ktime_add_safe(timer->node.expires, time);
212 timer->_softexpires = ktime_add_safe(timer->_softexpires, time); 208 timer->_softexpires = ktime_add_safe(timer->_softexpires, time);
213} 209}
214 210
215static inline void hrtimer_add_expires_ns(struct hrtimer *timer, u64 ns) 211static inline void hrtimer_add_expires_ns(struct hrtimer *timer, u64 ns)
216{ 212{
217 timer->_expires = ktime_add_ns(timer->_expires, ns); 213 timer->node.expires = ktime_add_ns(timer->node.expires, ns);
218 timer->_softexpires = ktime_add_ns(timer->_softexpires, ns); 214 timer->_softexpires = ktime_add_ns(timer->_softexpires, ns);
219} 215}
220 216
221static inline ktime_t hrtimer_get_expires(const struct hrtimer *timer) 217static inline ktime_t hrtimer_get_expires(const struct hrtimer *timer)
222{ 218{
223 return timer->_expires; 219 return timer->node.expires;
224} 220}
225 221
226static inline ktime_t hrtimer_get_softexpires(const struct hrtimer *timer) 222static inline ktime_t hrtimer_get_softexpires(const struct hrtimer *timer)
@@ -230,7 +226,7 @@ static inline ktime_t hrtimer_get_softexpires(const struct hrtimer *timer)
230 226
231static inline s64 hrtimer_get_expires_tv64(const struct hrtimer *timer) 227static inline s64 hrtimer_get_expires_tv64(const struct hrtimer *timer)
232{ 228{
233 return timer->_expires.tv64; 229 return timer->node.expires.tv64;
234} 230}
235static inline s64 hrtimer_get_softexpires_tv64(const struct hrtimer *timer) 231static inline s64 hrtimer_get_softexpires_tv64(const struct hrtimer *timer)
236{ 232{
@@ -239,12 +235,12 @@ static inline s64 hrtimer_get_softexpires_tv64(const struct hrtimer *timer)
239 235
240static inline s64 hrtimer_get_expires_ns(const struct hrtimer *timer) 236static inline s64 hrtimer_get_expires_ns(const struct hrtimer *timer)
241{ 237{
242 return ktime_to_ns(timer->_expires); 238 return ktime_to_ns(timer->node.expires);
243} 239}
244 240
245static inline ktime_t hrtimer_expires_remaining(const struct hrtimer *timer) 241static inline ktime_t hrtimer_expires_remaining(const struct hrtimer *timer)
246{ 242{
247 return ktime_sub(timer->_expires, timer->base->get_time()); 243 return ktime_sub(timer->node.expires, timer->base->get_time());
248} 244}
249 245
250#ifdef CONFIG_HIGH_RES_TIMERS 246#ifdef CONFIG_HIGH_RES_TIMERS