lkml.org 
[lkml]   [2009]   [Jul]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[tip:core/locking 3/3] lockdep:add likely/unlikely annotations to BFS core routine
Date
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


\
 
 \ /
  Last update: 2009-07-22 15:03    [W:0.069 / U:0.584 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site