rculfhash: add likely/unlikely annotation
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Tue, 12 Jul 2011 19:59:00 +0000 (15:59 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Tue, 12 Jul 2011 19:59:42 +0000 (15:59 -0400)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
rculfhash.c

index 15f56ef80caab5156414a648e5808607ab99da25..98547851b210a64e25788eef3cca2bc87f7ce8e0 100644 (file)
@@ -425,10 +425,10 @@ void _ht_gc_bucket(struct rcu_ht_node *dummy, struct rcu_ht_node *node)
                for (;;) {
                        if (unlikely(!clear_flag(iter)))
                                return;
-                       if (clear_flag(iter)->p.reverse_hash > node->p.reverse_hash)
+                       if (likely(clear_flag(iter)->p.reverse_hash > node->p.reverse_hash))
                                return;
                        next = rcu_dereference(clear_flag(iter)->p.next);
-                       if (is_removed(next))
+                       if (likely(is_removed(next)))
                                break;
                        iter_prev = clear_flag(iter);
                        iter = next;
@@ -474,10 +474,10 @@ struct rcu_ht_node *_ht_add(struct rcu_ht *ht, struct rcu_table *t,
                for (;;) {
                        if (unlikely(!clear_flag(iter)))
                                goto insert;
-                       if (clear_flag(iter)->p.reverse_hash > node->p.reverse_hash)
+                       if (likely(clear_flag(iter)->p.reverse_hash > node->p.reverse_hash))
                                goto insert;
                        next = rcu_dereference(clear_flag(iter)->p.next);
-                       if (is_removed(next))
+                       if (unlikely(is_removed(next)))
                                goto gc_node;
                        if (unique
                            && !is_dummy(next)
@@ -540,7 +540,7 @@ int _ht_remove(struct rcu_ht *ht, struct rcu_table *t, struct rcu_ht_node *node)
        old = rcu_dereference(node->p.next);
        do {
                next = old;
-               if (is_removed(next))
+               if (unlikely(is_removed(next)))
                        goto end;
                assert(!is_dummy(next));
                old = uatomic_cmpxchg(&node->p.next, next,
This page took 0.027939 seconds and 4 git commands to generate.