[tip:core/locking 3/3] lockdep:add likely/unlikely annotations to BFS core routine

From: tom . leiming
Date: Wed Jul 22 2009 - 08:59:36 EST


From: Ming Lei <tom.leiming@xxxxxxxxx>

Signed-off-by: Ming Lei <tom.leiming@xxxxxxxxx>
---
kernel/lockdep.c | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/kernel/lockdep.c b/kernel/lockdep.c
index 1583439..2bf49ae 100644
--- a/kernel/lockdep.c
+++ b/kernel/lockdep.c
@@ -951,18 +951,18 @@ static int __bfs(struct lock_list *source_entry,
else
head = &source_entry->class->locks_before;

- if (list_empty(head))
+ if (unlikely(list_empty(head)))
goto exit;

__cq_init(cq);
__cq_enqueue(cq, (unsigned long)source_entry);

- while (!__cq_empty(cq)) {
+ while (likely(!__cq_empty(cq))) {
struct lock_list *lock;

__cq_dequeue(cq, (unsigned long *)&lock);

- if (!lock->class) {
+ if (unlikely(!lock->class)) {
ret = -2;
goto exit;
}
@@ -982,12 +982,12 @@ static int __bfs(struct lock_list *source_entry,
goto exit;
}

- if (__cq_enqueue(cq, (unsigned long)entry)) {
+ if (unlikely(__cq_enqueue(cq, (unsigned long)entry))) {
ret = -1;
goto exit;
}
cq_depth = __cq_get_elem_count(cq);
- if (max_bfs_queue_depth < cq_depth)
+ if (unlikely(max_bfs_queue_depth < cq_depth))
max_bfs_queue_depth = cq_depth;
}
}
--
1.6.0.GIT

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/