lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Wed, 22 Jul 2009 20:58:33 +0800
From:	tom.leiming@...il.com
To:	a.p.zijlstra@...llo.nl
Cc:	linux-kernel@...r.kernel.org, akpm@...ux-foundation.org,
	mingo@...e.hu, torvalds@...ux-foundation.org,
	Ming Lei <tom.leiming@...il.com>
Subject: [tip:core/locking 3/3] lockdep:add likely/unlikely annotations to BFS core routine

From: Ming Lei <tom.leiming@...il.com>

Signed-off-by: Ming Lei <tom.leiming@...il.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

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ