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
| ||
|
Message-ID: <50CDF2A2.3090405@gmail.com> Date: Sun, 16 Dec 2012 17:11:14 +0100 From: Francesco Lavra <francescolavra.fl@...il.com> To: Daniel Lezcano <daniel.lezcano@...aro.org> CC: rjw@...k.pl, jwerner@...omium.org, linux-pm@...r.kernel.org, deepthi@...ux.vnet.ibm.com, g.trinabh@...il.com, linaro-dev@...ts.linaro.org, len.brown@...el.com, linux-kernel@...r.kernel.org, akpm@...ux-foundation.org, snanda@...omium.org Subject: Re: [PATCH 2/2][V2] cpuidle - optimize the select function for the 'menu' governor 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@...aro.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 -- 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