From: Xiongwei Song <sxwjean@me.com>
To: peterz@infradead.org, mingo@redhat.com, will@kernel.org,
longman@redhat.com, boqun.feng@gmail.com
Cc: linux-kernel@vger.kernel.org, Xiongwei Song <sxwjean@gmail.com>
Subject: [PATCH 1/3] locking/lockdep: unlikely bfs_error() inside
Date: Thu, 17 Jun 2021 22:28:26 +0800 [thread overview]
Message-ID: <20210617142828.346111-2-sxwjean@me.com> (raw)
In-Reply-To: <20210617142828.346111-1-sxwjean@me.com>
From: Xiongwei Song <sxwjean@gmail.com>
The error from graph walk is small probability event, and there are some
bfs_error calls during lockdep detection, so unlikely bfs_error inside
can improve performance a little bit.
Suggested-by: Waiman Long <longman@redhat.com>
Signed-off-by: Xiongwei Song <sxwjean@gmail.com>
---
kernel/locking/lockdep.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c
index 7641bd407239..a8a66a2a9bc1 100644
--- a/kernel/locking/lockdep.c
+++ b/kernel/locking/lockdep.c
@@ -1540,7 +1540,7 @@ enum bfs_result {
*/
static inline bool bfs_error(enum bfs_result res)
{
- return res < 0;
+ return unlikely(res < 0);
}
/*
@@ -2089,7 +2089,7 @@ check_path(struct held_lock *target, struct lock_list *src_entry,
ret = __bfs_forwards(src_entry, target, match, skip, target_entry);
- if (unlikely(bfs_error(ret)))
+ if (bfs_error(ret))
print_bfs_bug(ret);
return ret;
@@ -2936,7 +2936,7 @@ check_prev_add(struct task_struct *curr, struct held_lock *prev,
* in the graph whose neighbours are to be checked.
*/
ret = check_noncircular(next, prev, trace);
- if (unlikely(bfs_error(ret) || ret == BFS_RMATCH))
+ if (bfs_error(ret) || unlikely(ret == BFS_RMATCH))
return 0;
if (!check_irq_usage(curr, prev, next))
--
2.30.2
next prev parent reply other threads:[~2021-06-17 14:29 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-17 14:28 [PATCH 0/3] some improvements for lockdep Xiongwei Song
2021-06-17 14:28 ` Xiongwei Song [this message]
2021-06-17 14:28 ` [PATCH 2/3] locking/lockdep: unlikely conditons about BFS_RMATCH Xiongwei Song
2021-06-17 14:28 ` [PATCH 3/3] locking/lockdep: print possible warning after counting deps Xiongwei Song
2021-06-17 15:12 ` Boqun Feng
2021-06-18 1:54 ` Xiongwei Song
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210617142828.346111-2-sxwjean@me.com \
--to=sxwjean@me.com \
--cc=boqun.feng@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=longman@redhat.com \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=sxwjean@gmail.com \
--cc=will@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).