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-next>] [day] [month] [year] [list]
Message-Id: <20210616144210.278662-1-sxwjean@me.com>
Date:   Wed, 16 Jun 2021 22:42:09 +0800
From:   Xiongwei Song <sxwjean@...com>
To:     peterz@...radead.org, mingo@...hat.com, will@...nel.org,
        longman@...hat.com, boqun.feng@...il.com
Cc:     linux-kernel@...r.kernel.org, Xiongwei Song <sxwjean@...il.com>
Subject: [PATCH] locking/lockdep: unlikely bfs error check

From: Xiongwei Song <sxwjean@...il.com>

The error from graph walk is small probability event, so unlikely
bfs_error can improve performance a little bit.

Signed-off-by: Xiongwei Song <sxwjean@...il.com>
---
 kernel/locking/lockdep.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c
index 074fd6418c20..af8c9203cd3e 100644
--- a/kernel/locking/lockdep.c
+++ b/kernel/locking/lockdep.c
@@ -2646,7 +2646,7 @@ static int check_irq_usage(struct task_struct *curr, struct held_lock *prev,
 	bfs_init_rootb(&this, prev);
 
 	ret = __bfs_backwards(&this, &usage_mask, usage_accumulate, usage_skip, NULL);
-	if (bfs_error(ret)) {
+	if (unlikely(bfs_error(ret))) {
 		print_bfs_bug(ret);
 		return 0;
 	}
@@ -2664,7 +2664,7 @@ static int check_irq_usage(struct task_struct *curr, struct held_lock *prev,
 	bfs_init_root(&that, next);
 
 	ret = find_usage_forwards(&that, forward_mask, &target_entry1);
-	if (bfs_error(ret)) {
+	if (unlikely(bfs_error(ret))) {
 		print_bfs_bug(ret);
 		return 0;
 	}
@@ -2679,7 +2679,7 @@ static int check_irq_usage(struct task_struct *curr, struct held_lock *prev,
 	backward_mask = original_mask(target_entry1->class->usage_mask);
 
 	ret = find_usage_backwards(&this, backward_mask, &target_entry);
-	if (bfs_error(ret)) {
+	if (unlikely(bfs_error(ret))) {
 		print_bfs_bug(ret);
 		return 0;
 	}
@@ -2998,7 +2998,7 @@ check_prev_add(struct task_struct *curr, struct held_lock *prev,
 	 * Is the <prev> -> <next> link redundant?
 	 */
 	ret = check_redundant(prev, next);
-	if (bfs_error(ret))
+	if (unlikely(bfs_error(ret)))
 		return 0;
 	else if (ret == BFS_RMATCH)
 		return 2;
@@ -3911,7 +3911,7 @@ check_usage_forwards(struct task_struct *curr, struct held_lock *this,
 
 	bfs_init_root(&root, this);
 	ret = find_usage_forwards(&root, usage_mask, &target_entry);
-	if (bfs_error(ret)) {
+	if (unlikely(bfs_error(ret))) {
 		print_bfs_bug(ret);
 		return 0;
 	}
@@ -3946,7 +3946,7 @@ check_usage_backwards(struct task_struct *curr, struct held_lock *this,
 
 	bfs_init_rootb(&root, this);
 	ret = find_usage_backwards(&root, usage_mask, &target_entry);
-	if (bfs_error(ret)) {
+	if (unlikely(bfs_error(ret))) {
 		print_bfs_bug(ret);
 		return 0;
 	}
-- 
2.30.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ