diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-04-21 18:43:43 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-04-21 18:43:43 -0400 |
commit | 5dfeaef89559d4968b0470adf749659f10d722f6 (patch) | |
tree | e38f4177b8e2e12cd1aa2e9910beea1dc3578784 | |
parent | 429f731dea577bdd43693940cdca524135287e6a (diff) | |
parent | 259aae864ceeb2b34e7bafa1ce18d096a357fab2 (diff) |
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/tglx/linux-2.6-hrt
* 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/tglx/linux-2.6-hrt:
hrtimer: optimize the softirq time optimization
hrtimer: reduce calls to hrtimer_get_softirq_time()
clockevents: fix typo in tick-broadcast.c
jiffies: add time_is_after_jiffies and others which compare with jiffies
-rw-r--r-- | include/linux/jiffies.h | 16 | ||||
-rw-r--r-- | kernel/hrtimer.c | 63 | ||||
-rw-r--r-- | kernel/time/tick-broadcast.c | 2 |
3 files changed, 48 insertions, 33 deletions
diff --git a/include/linux/jiffies.h b/include/linux/jiffies.h index e0b5b684d83f..e377e34e589e 100644 --- a/include/linux/jiffies.h +++ b/include/linux/jiffies.h | |||
@@ -135,6 +135,22 @@ static inline u64 get_jiffies_64(void) | |||
135 | #define time_before_eq64(a,b) time_after_eq64(b,a) | 135 | #define time_before_eq64(a,b) time_after_eq64(b,a) |
136 | 136 | ||
137 | /* | 137 | /* |
138 | * These four macros compare jiffies and 'a' for convenience. | ||
139 | */ | ||
140 | |||
141 | /* time_is_before_jiffies(a) return true if a is before jiffies */ | ||
142 | #define time_is_before_jiffies(a) time_after(jiffies, a) | ||
143 | |||
144 | /* time_is_after_jiffies(a) return true if a is after jiffies */ | ||
145 | #define time_is_after_jiffies(a) time_before(jiffies, a) | ||
146 | |||
147 | /* time_is_before_eq_jiffies(a) return true if a is before or equal to jiffies*/ | ||
148 | #define time_is_before_eq_jiffies(a) time_after_eq(jiffies, a) | ||
149 | |||
150 | /* time_is_after_eq_jiffies(a) return true if a is after or equal to jiffies*/ | ||
151 | #define time_is_after_eq_jiffies(a) time_before_eq(jiffies, a) | ||
152 | |||
153 | /* | ||
138 | * Have the 32 bit jiffies value wrap 5 minutes after boot | 154 | * Have the 32 bit jiffies value wrap 5 minutes after boot |
139 | * so jiffies wrap bugs show up earlier. | 155 | * so jiffies wrap bugs show up earlier. |
140 | */ | 156 | */ |
diff --git a/kernel/hrtimer.c b/kernel/hrtimer.c index c642ef75069f..f78777abe769 100644 --- a/kernel/hrtimer.c +++ b/kernel/hrtimer.c | |||
@@ -1238,51 +1238,50 @@ void hrtimer_run_pending(void) | |||
1238 | /* | 1238 | /* |
1239 | * Called from hardirq context every jiffy | 1239 | * Called from hardirq context every jiffy |
1240 | */ | 1240 | */ |
1241 | static inline void run_hrtimer_queue(struct hrtimer_cpu_base *cpu_base, | 1241 | void hrtimer_run_queues(void) |
1242 | int index) | ||
1243 | { | 1242 | { |
1244 | struct rb_node *node; | 1243 | struct rb_node *node; |
1245 | struct hrtimer_clock_base *base = &cpu_base->clock_base[index]; | 1244 | struct hrtimer_cpu_base *cpu_base = &__get_cpu_var(hrtimer_bases); |
1245 | struct hrtimer_clock_base *base; | ||
1246 | int index, gettime = 1; | ||
1246 | 1247 | ||
1247 | if (!base->first) | 1248 | if (hrtimer_hres_active()) |
1248 | return; | 1249 | return; |
1249 | 1250 | ||
1250 | if (base->get_softirq_time) | 1251 | for (index = 0; index < HRTIMER_MAX_CLOCK_BASES; index++) { |
1251 | base->softirq_time = base->get_softirq_time(); | 1252 | base = &cpu_base->clock_base[index]; |
1252 | |||
1253 | spin_lock(&cpu_base->lock); | ||
1254 | 1253 | ||
1255 | while ((node = base->first)) { | 1254 | if (!base->first) |
1256 | struct hrtimer *timer; | ||
1257 | |||
1258 | timer = rb_entry(node, struct hrtimer, node); | ||
1259 | if (base->softirq_time.tv64 <= timer->expires.tv64) | ||
1260 | break; | ||
1261 | |||
1262 | if (timer->cb_mode == HRTIMER_CB_SOFTIRQ) { | ||
1263 | __remove_hrtimer(timer, base, HRTIMER_STATE_PENDING, 0); | ||
1264 | list_add_tail(&timer->cb_entry, | ||
1265 | &base->cpu_base->cb_pending); | ||
1266 | continue; | 1255 | continue; |
1256 | |||
1257 | if (base->get_softirq_time) | ||
1258 | base->softirq_time = base->get_softirq_time(); | ||
1259 | else if (gettime) { | ||
1260 | hrtimer_get_softirq_time(cpu_base); | ||
1261 | gettime = 0; | ||
1267 | } | 1262 | } |
1268 | 1263 | ||
1269 | __run_hrtimer(timer); | 1264 | spin_lock(&cpu_base->lock); |
1270 | } | ||
1271 | spin_unlock(&cpu_base->lock); | ||
1272 | } | ||
1273 | 1265 | ||
1274 | void hrtimer_run_queues(void) | 1266 | while ((node = base->first)) { |
1275 | { | 1267 | struct hrtimer *timer; |
1276 | struct hrtimer_cpu_base *cpu_base = &__get_cpu_var(hrtimer_bases); | ||
1277 | int i; | ||
1278 | 1268 | ||
1279 | if (hrtimer_hres_active()) | 1269 | timer = rb_entry(node, struct hrtimer, node); |
1280 | return; | 1270 | if (base->softirq_time.tv64 <= timer->expires.tv64) |
1271 | break; | ||
1281 | 1272 | ||
1282 | hrtimer_get_softirq_time(cpu_base); | 1273 | if (timer->cb_mode == HRTIMER_CB_SOFTIRQ) { |
1274 | __remove_hrtimer(timer, base, | ||
1275 | HRTIMER_STATE_PENDING, 0); | ||
1276 | list_add_tail(&timer->cb_entry, | ||
1277 | &base->cpu_base->cb_pending); | ||
1278 | continue; | ||
1279 | } | ||
1283 | 1280 | ||
1284 | for (i = 0; i < HRTIMER_MAX_CLOCK_BASES; i++) | 1281 | __run_hrtimer(timer); |
1285 | run_hrtimer_queue(cpu_base, i); | 1282 | } |
1283 | spin_unlock(&cpu_base->lock); | ||
1284 | } | ||
1286 | } | 1285 | } |
1287 | 1286 | ||
1288 | /* | 1287 | /* |
diff --git a/kernel/time/tick-broadcast.c b/kernel/time/tick-broadcast.c index fdfa0c745bb6..57a1f02e5ec0 100644 --- a/kernel/time/tick-broadcast.c +++ b/kernel/time/tick-broadcast.c | |||
@@ -262,7 +262,7 @@ out: | |||
262 | void tick_broadcast_on_off(unsigned long reason, int *oncpu) | 262 | void tick_broadcast_on_off(unsigned long reason, int *oncpu) |
263 | { | 263 | { |
264 | if (!cpu_isset(*oncpu, cpu_online_map)) | 264 | if (!cpu_isset(*oncpu, cpu_online_map)) |
265 | printk(KERN_ERR "tick-braodcast: ignoring broadcast for " | 265 | printk(KERN_ERR "tick-broadcast: ignoring broadcast for " |
266 | "offline CPU #%d\n", *oncpu); | 266 | "offline CPU #%d\n", *oncpu); |
267 | else | 267 | else |
268 | smp_call_function_single(*oncpu, tick_do_broadcast_on_off, | 268 | smp_call_function_single(*oncpu, tick_do_broadcast_on_off, |