lkml.org 
[lkml]   [2015]   [Apr]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[patch 10/39] hrtimer: Use cpu_base->active_base for hotpath iterators
Now that we have the active_bases field in sync we can use it for
iterating over the clock bases. This allows to break out early if no
more active clock bases are available and avoids touching the cache
lines of inactive clock bases.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
kernel/time/hrtimer.c | 17 ++++++++---------
1 file changed, 8 insertions(+), 9 deletions(-)

Index: tip/kernel/time/hrtimer.c
===================================================================
--- tip.orig/kernel/time/hrtimer.c
+++ tip/kernel/time/hrtimer.c
@@ -419,16 +419,16 @@ static ktime_t __hrtimer_get_next_event(
{
struct hrtimer_clock_base *base = cpu_base->clock_base;
ktime_t expires, expires_next = { .tv64 = KTIME_MAX };
- int i;
+ unsigned int active = cpu_base->active_bases;

- for (i = 0; i < HRTIMER_MAX_CLOCK_BASES; i++, base++) {
+ for (; active; base++, active >>= 1) {
struct timerqueue_node *next;
struct hrtimer *timer;

- next = timerqueue_getnext(&base->active);
- if (!next)
+ if (!(active & 0x01))
continue;

+ next = timerqueue_getnext(&base->active);
timer = container_of(next, struct hrtimer, node);
expires = ktime_sub(hrtimer_get_expires(timer), base->offset);
if (expires.tv64 < expires_next.tv64)
@@ -1206,17 +1206,16 @@ static void __run_hrtimer(struct hrtimer

static void __hrtimer_run_queues(struct hrtimer_cpu_base *cpu_base, ktime_t now)
{
- int i;
+ struct hrtimer_clock_base *base = cpu_base->clock_base;
+ unsigned int active = cpu_base->active_bases;

- for (i = 0; i < HRTIMER_MAX_CLOCK_BASES; i++) {
- struct hrtimer_clock_base *base;
+ for (; active; base++, active >>= 1) {
struct timerqueue_node *node;
ktime_t basenow;

- if (!(cpu_base->active_bases & (1 << i)))
+ if (!(active & 0x01))
continue;

- base = cpu_base->clock_base + i;
basenow = ktime_add(now, base->offset);

while ((node = timerqueue_getnext(&base->active))) {



\
 
 \ /
  Last update: 2015-04-14 23:41    [W:0.429 / U:0.468 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site