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: <CAKohpo=HxqVnd6VejLZTiKsQ95K0Fxu6DLhAJr3ZR3BK+gGyDQ@mail.gmail.com>
Date:	Mon, 9 Jun 2014 14:57:52 +0530
From:	Viresh Kumar <viresh.kumar@...aro.org>
To:	Stanislav Fomichev <stfomichev@...dex-team.ru>
Cc:	Thomas Gleixner <tglx@...utronix.de>,
	Paul Gortmaker <paul.gortmaker@...driver.com>,
	Peter Zijlstra <peterz@...radead.org>,
	stuart.w.hayes@...il.com, david.vrabel@...rix.com,
	Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] hrtimers: conditionally lock/unlock spinlock in hrtimer_get_next_event

On 9 June 2014 14:53, Stanislav Fomichev <stfomichev@...dex-team.ru> wrote:
> In hrtimer_get_next_event we unconditionally lock/unlock spinlock, even if it's
> not required (hrtimer_hres_active() != 0). This patch moves
> locking/unlocking and mindelta range check inside the if clause,
> so we don't execute unnecessary operations.
>
> Signed-off-by: Stanislav Fomichev <stfomichev@...dex-team.ru>
> ---
>  kernel/hrtimer.c | 13 +++++++------
>  1 file changed, 7 insertions(+), 6 deletions(-)
>
> diff --git a/kernel/hrtimer.c b/kernel/hrtimer.c
> index 39f339dcbe93..ce21e5f6bcf0 100644
> --- a/kernel/hrtimer.c
> +++ b/kernel/hrtimer.c
> @@ -1166,9 +1166,9 @@ ktime_t hrtimer_get_next_event(void)
>         unsigned long flags;
>         int i;
>
> -       raw_spin_lock_irqsave(&cpu_base->lock, flags);
> -
>         if (!hrtimer_hres_active()) {
> +               raw_spin_lock_irqsave(&cpu_base->lock, flags);
> +
>                 for (i = 0; i < HRTIMER_MAX_CLOCK_BASES; i++, base++) {
>                         struct hrtimer *timer;
>                         struct timerqueue_node *next;
> @@ -1183,12 +1183,13 @@ ktime_t hrtimer_get_next_event(void)
>                         if (delta.tv64 < mindelta.tv64)
>                                 mindelta.tv64 = delta.tv64;
>                 }
> -       }
>
> -       raw_spin_unlock_irqrestore(&cpu_base->lock, flags);
> +               raw_spin_unlock_irqrestore(&cpu_base->lock, flags);
> +
> +               if (mindelta.tv64 < 0)
> +                       mindelta.tv64 = 0;
> +       }
>
> -       if (mindelta.tv64 < 0)
> -               mindelta.tv64 = 0;
>         return mindelta;
>  }

Reviewed-by: Viresh Kumar <viresh.kumar@...aro.org>
--
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