From: Muchun Song <smuchun@gmail.com>
To: gregkh@linuxfoundation.org, rafael@kernel.org
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] driver core: Add branch prediction hints in really_probe()
Date: Tue, 6 Nov 2018 21:46:30 +0800 [thread overview]
Message-ID: <20181106134630.29591-1-smuchun@gmail.com> (raw)
If condition is false in most cases. So, add an unlikely() to the if
condition, so that the optimizer assumes that the condition is false.
Signed-off-by: Muchun Song <smuchun@gmail.com>
---
drivers/base/dd.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/base/dd.c b/drivers/base/dd.c
index 169412ee4ae8..8eba453c4e5d 100644
--- a/drivers/base/dd.c
+++ b/drivers/base/dd.c
@@ -450,7 +450,7 @@ static int really_probe(struct device *dev, struct device_driver *drv)
bool test_remove = IS_ENABLED(CONFIG_DEBUG_TEST_DRIVER_REMOVE) &&
!drv->suppress_bind_attrs;
- if (defer_all_probes) {
+ if (unlikely(defer_all_probes)) {
/*
* Value of defer_all_probes can be set only by
* device_defer_all_probes_enable() which, in turn, will call
@@ -508,7 +508,7 @@ static int really_probe(struct device *dev, struct device_driver *drv)
goto probe_failed;
}
- if (test_remove) {
+ if (unlikely(test_remove)) {
test_remove = false;
if (dev->bus->remove)
--
2.17.1
next reply other threads:[~2018-11-06 13:47 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-06 13:46 Muchun Song [this message]
2018-11-06 14:30 ` [PATCH] driver core: Add branch prediction hints in really_probe() Rafael J. Wysocki
2018-11-06 14:43 ` Muchun Song
2018-11-06 14:59 ` Rafael J. Wysocki
2018-11-06 15:12 ` Muchun Song
2018-11-06 20:26 ` Greg KH
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=20181106134630.29591-1-smuchun@gmail.com \
--to=smuchun@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rafael@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