* [RFC PATCH] cpuidle: reduce unnecessary loop in c-state selection
@ 2014-01-16 12:45 Alex Shi
2014-01-16 15:53 ` Rafael J. Wysocki
0 siblings, 1 reply; 4+ messages in thread
From: Alex Shi @ 2014-01-16 12:45 UTC (permalink / raw)
To: rjw, daniel.lezcano; +Cc: linux-pm, Alex Shi
All deeper c-state have the longer target_residency and exit_latency
So, if the one can not meet our prediction, neither any later.
So, just break out the for loop to save few checking instructions.
Signed-off-by: Alex Shi <alex.shi@linaro.org>
---
| 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
--git a/drivers/cpuidle/governors/menu.c b/drivers/cpuidle/governors/menu.c
index cf7f2f0..48ed3fb 100644
--- a/drivers/cpuidle/governors/menu.c
+++ b/drivers/cpuidle/governors/menu.c
@@ -352,11 +352,11 @@ static int menu_select(struct cpuidle_driver *drv, struct cpuidle_device *dev)
if (s->disabled || su->disable)
continue;
if (s->target_residency > data->predicted_us)
- continue;
+ break;
if (s->exit_latency > latency_req)
- continue;
+ break;
if (s->exit_latency * multiplier > data->predicted_us)
- continue;
+ break;
data->last_state_idx = i;
data->exit_us = s->exit_latency;
--
1.8.1.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [RFC PATCH] cpuidle: reduce unnecessary loop in c-state selection
2014-01-16 12:45 [RFC PATCH] cpuidle: reduce unnecessary loop in c-state selection Alex Shi
@ 2014-01-16 15:53 ` Rafael J. Wysocki
2014-01-22 7:53 ` Alex Shi
0 siblings, 1 reply; 4+ messages in thread
From: Rafael J. Wysocki @ 2014-01-16 15:53 UTC (permalink / raw)
To: Len Brown; +Cc: Alex Shi, daniel.lezcano, linux-pm
Hi Len, what do you think?
On Thursday, January 16, 2014 08:45:16 PM Alex Shi wrote:
> All deeper c-state have the longer target_residency and exit_latency
> So, if the one can not meet our prediction, neither any later.
> So, just break out the for loop to save few checking instructions.
>
> Signed-off-by: Alex Shi <alex.shi@linaro.org>
> ---
> drivers/cpuidle/governors/menu.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/cpuidle/governors/menu.c b/drivers/cpuidle/governors/menu.c
> index cf7f2f0..48ed3fb 100644
> --- a/drivers/cpuidle/governors/menu.c
> +++ b/drivers/cpuidle/governors/menu.c
> @@ -352,11 +352,11 @@ static int menu_select(struct cpuidle_driver *drv, struct cpuidle_device *dev)
> if (s->disabled || su->disable)
> continue;
> if (s->target_residency > data->predicted_us)
> - continue;
> + break;
> if (s->exit_latency > latency_req)
> - continue;
> + break;
> if (s->exit_latency * multiplier > data->predicted_us)
> - continue;
> + break;
>
> data->last_state_idx = i;
> data->exit_us = s->exit_latency;
>
--
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [RFC PATCH] cpuidle: reduce unnecessary loop in c-state selection
2014-01-16 15:53 ` Rafael J. Wysocki
@ 2014-01-22 7:53 ` Alex Shi
2014-01-22 8:19 ` Daniel Lezcano
0 siblings, 1 reply; 4+ messages in thread
From: Alex Shi @ 2014-01-22 7:53 UTC (permalink / raw)
To: Rafael J. Wysocki, Len Brown; +Cc: daniel.lezcano, linux-pm
On 01/16/2014 11:53 PM, Rafael J. Wysocki wrote:
> Hi Len, what do you think?
Is this patch correct?
>
> On Thursday, January 16, 2014 08:45:16 PM Alex Shi wrote:
>> All deeper c-state have the longer target_residency and exit_latency
>> So, if the one can not meet our prediction, neither any later.
>> So, just break out the for loop to save few checking instructions.
>>
>> Signed-off-by: Alex Shi <alex.shi@linaro.org>
>> ---
>> drivers/cpuidle/governors/menu.c | 6 +++---
>> 1 file changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/cpuidle/governors/menu.c b/drivers/cpuidle/governors/menu.c
>> index cf7f2f0..48ed3fb 100644
>> --- a/drivers/cpuidle/governors/menu.c
>> +++ b/drivers/cpuidle/governors/menu.c
>> @@ -352,11 +352,11 @@ static int menu_select(struct cpuidle_driver *drv, struct cpuidle_device *dev)
>> if (s->disabled || su->disable)
>> continue;
>> if (s->target_residency > data->predicted_us)
>> - continue;
>> + break;
>> if (s->exit_latency > latency_req)
>> - continue;
>> + break;
>> if (s->exit_latency * multiplier > data->predicted_us)
>> - continue;
>> + break;
>>
>> data->last_state_idx = i;
>> data->exit_us = s->exit_latency;
>>
>
--
Thanks
Alex
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [RFC PATCH] cpuidle: reduce unnecessary loop in c-state selection
2014-01-22 7:53 ` Alex Shi
@ 2014-01-22 8:19 ` Daniel Lezcano
0 siblings, 0 replies; 4+ messages in thread
From: Daniel Lezcano @ 2014-01-22 8:19 UTC (permalink / raw)
To: Alex Shi, Rafael J. Wysocki, Len Brown; +Cc: linux-pm
On 01/22/2014 08:53 AM, Alex Shi wrote:
> On 01/16/2014 11:53 PM, Rafael J. Wysocki wrote:
>> Hi Len, what do you think?
>
> Is this patch correct?
Well, there is no rule telling in what order the idle states are, except
they are ordered by power consumption.
But regarding how are defined the different idle states in the drivers,
I think this patch makes sense.
>>
>> On Thursday, January 16, 2014 08:45:16 PM Alex Shi wrote:
>>> All deeper c-state have the longer target_residency and exit_latency
>>> So, if the one can not meet our prediction, neither any later.
>>> So, just break out the for loop to save few checking instructions.
>>>
>>> Signed-off-by: Alex Shi <alex.shi@linaro.org>
>>> ---
>>> drivers/cpuidle/governors/menu.c | 6 +++---
>>> 1 file changed, 3 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/drivers/cpuidle/governors/menu.c b/drivers/cpuidle/governors/menu.c
>>> index cf7f2f0..48ed3fb 100644
>>> --- a/drivers/cpuidle/governors/menu.c
>>> +++ b/drivers/cpuidle/governors/menu.c
>>> @@ -352,11 +352,11 @@ static int menu_select(struct cpuidle_driver *drv, struct cpuidle_device *dev)
>>> if (s->disabled || su->disable)
>>> continue;
>>> if (s->target_residency > data->predicted_us)
>>> - continue;
>>> + break;
>>> if (s->exit_latency > latency_req)
>>> - continue;
>>> + break;
>>> if (s->exit_latency * multiplier > data->predicted_us)
>>> - continue;
>>> + break;
>>>
>>> data->last_state_idx = i;
>>> data->exit_us = s->exit_latency;
>>>
>>
>
>
--
<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
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-01-22 8:19 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-16 12:45 [RFC PATCH] cpuidle: reduce unnecessary loop in c-state selection Alex Shi
2014-01-16 15:53 ` Rafael J. Wysocki
2014-01-22 7:53 ` Alex Shi
2014-01-22 8:19 ` Daniel Lezcano
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).