From: Francesco Lavra <francescolavra.fl@gmail.com>
To: Daniel Lezcano <daniel.lezcano@linaro.org>
Cc: rjw@sisk.pl, jwerner@chromium.org, linux-pm@vger.kernel.org,
deepthi@linux.vnet.ibm.com, g.trinabh@gmail.com,
linaro-dev@lists.linaro.org, len.brown@intel.com,
linux-kernel@vger.kernel.org, akpm@linux-foundation.org,
snanda@chromium.org
Subject: Re: [PATCH 2/2][V2] cpuidle - optimize the select function for the 'menu' governor
Date: Sun, 16 Dec 2012 17:11:14 +0100 [thread overview]
Message-ID: <50CDF2A2.3090405@gmail.com> (raw)
In-Reply-To: <1355493455-30665-3-git-send-email-daniel.lezcano@linaro.org>
Hi Daniel,
On 12/14/2012 02:57 PM, Daniel Lezcano wrote:
> As the power is backward sorted in the states array and we are looking for
> the state consuming the little power as possible, instead of looking from
> the beginning of the array, we look from the end. That should save us some
> iterations in the loop each time we select a state at idle time.
>
> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
> ---
> drivers/cpuidle/governors/menu.c | 12 ++++++------
> 1 files changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/cpuidle/governors/menu.c b/drivers/cpuidle/governors/menu.c
> index fe343a0..05b8998 100644
> --- a/drivers/cpuidle/governors/menu.c
> +++ b/drivers/cpuidle/governors/menu.c
> @@ -367,24 +367,24 @@ static int menu_select(struct cpuidle_driver *drv, struct cpuidle_device *dev)
> * Find the idle state with the lowest power while satisfying
> * our constraints.
> */
> - for (i = CPUIDLE_DRIVER_STATE_START; i < drv->state_count; i++) {
> + for (i = drv->state_count - 1; i >= CPUIDLE_DRIVER_STATE_START; i--) {
> struct cpuidle_state *s = &drv->states[i];
> struct cpuidle_state_usage *su = &dev->states_usage[i];
>
> if (s->disabled || su->disable)
> continue;
> - if (s->target_residency > data->predicted_us) {
> - low_predicted = 1;
> - continue;
> - }
> if (s->exit_latency > latency_req)
> continue;
> + if (s->target_residency > data->predicted_us)
> + continue;
> if (s->exit_latency * multiplier > data->predicted_us)
> continue;
>
> + low_predicted = i - CPUIDLE_DRIVER_STATE_START;
You are altering the semantics of low_predicted, which is supposed to be
non-zero when the deepest C-state has not been chosen because its target
residency is more than the predicted residency.
It seems to me that the if block where target_residency is compared with
the predicted residency should be left as is.
> data->last_state_idx = i;
> data->exit_us = s->exit_latency;
> - }
> + break;
> + }
>
> /* not deepest C-state chosen for low predicted residency */
> if (low_predicted) {
--
Francesco
next prev parent reply other threads:[~2012-12-16 16:11 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-14 13:57 [PATCH 0/2][V2] cpuidle - remove power from the select equation Daniel Lezcano
[not found] ` <1355493455-30665-1-git-send-email-daniel.lezcano-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2012-12-14 13:57 ` [PATCH 1/2][V2] cpuidle - remove the power_specified field in the driver Daniel Lezcano
2012-12-14 13:57 ` [PATCH 2/2][V2] cpuidle - optimize the select function for the 'menu' governor Daniel Lezcano
2012-12-16 16:11 ` Francesco Lavra [this message]
2013-01-11 19:12 ` Julius Werner
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=50CDF2A2.3090405@gmail.com \
--to=francescolavra.fl@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=daniel.lezcano@linaro.org \
--cc=deepthi@linux.vnet.ibm.com \
--cc=g.trinabh@gmail.com \
--cc=jwerner@chromium.org \
--cc=len.brown@intel.com \
--cc=linaro-dev@lists.linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=rjw@sisk.pl \
--cc=snanda@chromium.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;
as well as URLs for NNTP newsgroup(s).