Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=99bc2fcb283852931fb6bbef40f3df8316b59000
Commit:     99bc2fcb283852931fb6bbef40f3df8316b59000
Parent:     820de5c39ef7f6866d2c9e6c7d208bcd2a6e1942
Author:     Ingo Molnar <[EMAIL PROTECTED]>
AuthorDate: Sat Jul 21 04:37:36 2007 -0700
Committer:  Linus Torvalds <[EMAIL PROTECTED]>
CommitDate: Sat Jul 21 17:49:15 2007 -0700

    hrtimer: speedup hrtimer_enqueue
    
    Speedup hrtimer_enqueue by evaluating the rbtree insertion result.
    
    Signed-off-by: Ingo Molnar <[EMAIL PROTECTED]>
    Signed-off-by: Thomas Gleixner <[EMAIL PROTECTED]>
    Cc: john stultz <[EMAIL PROTECTED]>
    Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
    Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
---
 kernel/hrtimer.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/kernel/hrtimer.c b/kernel/hrtimer.c
index 065a897..eb1ddeb 100644
--- a/kernel/hrtimer.c
+++ b/kernel/hrtimer.c
@@ -686,6 +686,7 @@ static void enqueue_hrtimer(struct hrtimer *timer,
        struct rb_node **link = &base->active.rb_node;
        struct rb_node *parent = NULL;
        struct hrtimer *entry;
+       int leftmost = 1;
 
        /*
         * Find the right place in the rbtree:
@@ -697,18 +698,19 @@ static void enqueue_hrtimer(struct hrtimer *timer,
                 * We dont care about collisions. Nodes with
                 * the same expiry time stay together.
                 */
-               if (timer->expires.tv64 < entry->expires.tv64)
+               if (timer->expires.tv64 < entry->expires.tv64) {
                        link = &(*link)->rb_left;
-               else
+               } else {
                        link = &(*link)->rb_right;
+                       leftmost = 0;
+               }
        }
 
        /*
         * Insert the timer to the rbtree and check whether it
         * replaces the first pending timer
         */
-       if (!base->first || timer->expires.tv64 <
-           rb_entry(base->first, struct hrtimer, node)->expires.tv64) {
+       if (leftmost) {
                /*
                 * Reprogram the clock event device. When the timer is already
                 * expired hrtimer_enqueue_reprogram has either called the
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to