Commit 99bc2fcb authored by Ingo Molnar's avatar Ingo Molnar Committed by Linus Torvalds

hrtimer: speedup hrtimer_enqueue

Speedup hrtimer_enqueue by evaluating the rbtree insertion result.
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
Cc: john stultz <johnstul@us.ibm.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 820de5c3
...@@ -686,6 +686,7 @@ static void enqueue_hrtimer(struct hrtimer *timer, ...@@ -686,6 +686,7 @@ static void enqueue_hrtimer(struct hrtimer *timer,
struct rb_node **link = &base->active.rb_node; struct rb_node **link = &base->active.rb_node;
struct rb_node *parent = NULL; struct rb_node *parent = NULL;
struct hrtimer *entry; struct hrtimer *entry;
int leftmost = 1;
/* /*
* Find the right place in the rbtree: * Find the right place in the rbtree:
...@@ -697,18 +698,19 @@ static void enqueue_hrtimer(struct hrtimer *timer, ...@@ -697,18 +698,19 @@ static void enqueue_hrtimer(struct hrtimer *timer,
* We dont care about collisions. Nodes with * We dont care about collisions. Nodes with
* the same expiry time stay together. * the same expiry time stay together.
*/ */
if (timer->expires.tv64 < entry->expires.tv64) if (timer->expires.tv64 < entry->expires.tv64) {
link = &(*link)->rb_left; link = &(*link)->rb_left;
else } else {
link = &(*link)->rb_right; link = &(*link)->rb_right;
leftmost = 0;
}
} }
/* /*
* Insert the timer to the rbtree and check whether it * Insert the timer to the rbtree and check whether it
* replaces the first pending timer * replaces the first pending timer
*/ */
if (!base->first || timer->expires.tv64 < if (leftmost) {
rb_entry(base->first, struct hrtimer, node)->expires.tv64) {
/* /*
* Reprogram the clock event device. When the timer is already * Reprogram the clock event device. When the timer is already
* expired hrtimer_enqueue_reprogram has either called the * expired hrtimer_enqueue_reprogram has either called the
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment