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]
Message-ID: <CAJZ5v0ifsQqkoFw2tossFKJAUkqDLdR9NpN3eZTn3t0xUz6K-g@mail.gmail.com>
Date:   Tue, 6 Nov 2018 15:30:14 +0100
From:   "Rafael J. Wysocki" <rafael@...nel.org>
To:     smuchun@...il.com
Cc:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        "Rafael J. Wysocki" <rafael@...nel.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] driver core: Add branch prediction hints in really_probe()

On Tue, Nov 6, 2018 at 2:47 PM Muchun Song <smuchun@...il.com> wrote:
>
> 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@...il.com>

Have you measured the practical impact of this patch in any way?

> ---
>  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
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ