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]
Date:	Wed, 08 May 2013 13:08:58 +0200
From:	Daniel Lezcano <daniel.lezcano@...aro.org>
To:	Lianwei Wang <lianwei.wang@...il.com>
CC:	linux-kernel@...r.kernel.org, linux-pm@...ts.linux-foundation.org
Subject: Re: [linux-pm] [PATCH] cpuidle: don't wakeup processor when set a
 longer latency

On 05/08/2013 04:44 AM, Lianwei Wang wrote:
> When a PM-Qos is updated, the cpuidle driver will wakeup all the CPUs
> no matter what a latency is set. But actually it only need to wakeup
> the CPUs when a shorter latency is set. In this way we can reduce the
> cpu wakeup count and save battery.

I am curious, how many times could the pm_qos be changed in a system
live cycle to measure an improvement with this patch ?

Do you have a scenario where you measured a noticeable power saving ?

> So we can pass the prev_value to the notifier callback and check the
> latency curr_value and prev_value in the cpuidle latency notifier
> callback. It modify a common interface(dummy --> prev_value) but shall
> be safe since no one use the dummy parameter currently.
> 
> diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c
> index e1f6860..1e1758c 100644
> --- a/drivers/cpuidle/cpuidle.c
> +++ b/drivers/cpuidle/cpuidle.c
> @@ -498,7 +498,11 @@ static void smp_callback(void *v)
>  static int cpuidle_latency_notify(struct notifier_block *b,
>                 unsigned long l, void *v)
>  {
> -       smp_call_function(smp_callback, NULL, 1);
> +       unsigned long prev_value = (unsigned long) v;
> +
> +       /* Dont't waktup processor when set a longer latency */

                    ^^^^^^
                    wakeup

Instead of passing prev and curr, using the dummy variable, why don't
you pass the result of (curr - prev) ?

A negative value means, the latency is smaller and positive is bigger.

Also, may be the optimization could be more improved: if the latency is
bigger than the next wakeup event, it is not necessary to wakeup the cpus.

> +       if (l < prev_value)
> +               smp_call_function(smp_callback, NULL, 1);
>         return NOTIFY_OK;
>  }
> 
> diff --git a/kernel/power/qos.c b/kernel/power/qos.c
> index 9322ff7..533b8bc 100644
> --- a/kernel/power/qos.c
> +++ b/kernel/power/qos.c
> @@ -205,7 +205,7 @@ int pm_qos_update_target(struct pm_qos_constraints
> *c, struct plist_node *node,
>         if (prev_value != curr_value) {
>                 blocking_notifier_call_chain(c->notifiers,
>                                              (unsigned long)curr_value,
> -                                            NULL);
> +                                            (void *)prev_value);
>                 return 1;
>         } else {
>                 return 0;
> 


-- 
 <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog

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