Messages in this thread Patch in this message | | | From | tom.leiming@gmail ... | Subject | [tip:core/locking 3/3] lockdep:add likely/unlikely annotations to BFS core routine | Date | Wed, 22 Jul 2009 20:58:33 +0800 |
| |
From: Ming Lei <tom.leiming@gmail.com>
Signed-off-by: Ming Lei <tom.leiming@gmail.com> --- 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
| |