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: <CAMbhsRQRGGpShFiTBP7OZ8txhKG_i-1_s=AAGPQx+JzTkW=0Lg@mail.gmail.com>
Date:	Wed, 25 Sep 2013 17:25:28 -0700
From:	Colin Cross <ccross@...gle.com>
To:	Viresh Kumar <viresh.kumar@...aro.org>
Cc:	"Rafael J. Wysocki" <rjw@...k.pl>,
	Daniel Lezcano <daniel.lezcano@...aro.org>,
	"linaro-kernel@...ts.linaro.org" <linaro-kernel@...ts.linaro.org>,
	"patches@...aro.org" <patches@...aro.org>,
	Linux PM list <linux-pm@...r.kernel.org>,
	lkml <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 14/21] cpuidle: coupled: don't compare cpu masks unnecessarily

On Sat, Sep 21, 2013 at 6:21 PM, Viresh Kumar <viresh.kumar@...aro.org> wrote:
> In cpuidle_coupled_register_device() we do following:
>         if (WARN_ON(!cpumask_equal(&dev->coupled_cpus, &coupled->coupled_cpus)))
>                 coupled->prevent++;
>
> This is only required to be done when we are using 'coupled' from an existing
> cpuidle_device and not when we have just done this:
>
>         coupled->coupled_cpus = dev->coupled_cpus
>
> So, move this compare statement to the right place.
>
> Signed-off-by: Viresh Kumar <viresh.kumar@...aro.org>

I don't agree with this.  This patch is a tiny optimization in code
that is rarely called, and it moves a final sanity check somewhere
that it might get missed if the code were later refactored.

> ---
>  drivers/cpuidle/coupled.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/cpuidle/coupled.c b/drivers/cpuidle/coupled.c
> index e952936..19a89eb 100644
> --- a/drivers/cpuidle/coupled.c
> +++ b/drivers/cpuidle/coupled.c
> @@ -642,6 +642,10 @@ int cpuidle_coupled_register_device(struct cpuidle_device *dev)
>                 other_dev = per_cpu(cpuidle_devices, cpu);
>                 if (other_dev && other_dev->coupled) {
>                         coupled = other_dev->coupled;
> +
> +                       if (WARN_ON(!cpumask_equal(&dev->coupled_cpus,
> +                                               &coupled->coupled_cpus)))
> +                               coupled->prevent++;
>                         goto have_coupled;
>                 }
>         }
> @@ -655,9 +659,6 @@ int cpuidle_coupled_register_device(struct cpuidle_device *dev)
>
>  have_coupled:
>         dev->coupled = coupled;
> -       if (WARN_ON(!cpumask_equal(&dev->coupled_cpus, &coupled->coupled_cpus)))
> -               coupled->prevent++;
> -
>         cpuidle_coupled_update_online_cpus(coupled);
>
>         coupled->refcnt++;
> --
> 1.7.12.rc2.18.g61b472e
>
> --
> 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/
--
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