* [PATCH 2/3] cpuidle ladder: Better idle duration measurement without using CPUIDLE_FLAG_TIME_INVALID
2014-12-16 6:52 ` [PATCH 1/3] cpuidle menu: Better idle duration measurement without using CPUIDLE_FLAG_TIME_INVALID Len Brown
@ 2014-12-16 6:52 ` Len Brown
2014-12-16 11:07 ` Daniel Lezcano
2014-12-16 6:52 ` [PATCH 3/3] cpuidle, ACPI: remove unused CPUIDLE_FLAG_TIME_INVALID Len Brown
` (2 subsequent siblings)
3 siblings, 1 reply; 9+ messages in thread
From: Len Brown @ 2014-12-16 6:52 UTC (permalink / raw)
To: linux-pm, linux-acpi; +Cc: Len Brown, Daniel Lezcano
From: Len Brown <len.brown@intel.com>
When the ladder governor sees the CPUIDLE_FLAG_TIME_INVALID flag,
it unconditionally causes a state promotion by setting last_residency
to a number higher than the state's promotion_time:
last_residency = last_state->threshold.promotion_time + 1
It does this for fear that cpuidle_get_last_residency()
will be in-accurate, because cpuidle_enter_state() invoked
a state with CPUIDLE_FLAG_TIME_INVALID.
But the only state with CPUIDLE_FLAG_TIME_INVALID is
acpi_safe_halt(), which may return well after its actual
idle duration because it enables interrupts, so cpuidle_enter_state()
also measures interrupt service time.
So what? In ladder, a huge invalid last_residency has exactly
the same effect as the current code -- it unconditionally
causes a state promotion.
In the case where the idle residency plus measured interrupt
handling time is less than the state's demotion_time -- we should
use that timestamp to give ladder a chance to demote, rather than
unconditionally promoting.
This can be done by simply ignoring the CPUIDLE_FLAG_TIME_INVALID,
and using the "invalid" time, as it is either equal to what we are
doing today, or better.
Signed-off-by: Len Brown <len.brown@intel.com>
Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
---
drivers/cpuidle/governors/ladder.c | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
diff --git a/drivers/cpuidle/governors/ladder.c b/drivers/cpuidle/governors/ladder.c
index 37263d9..401c010 100644
--- a/drivers/cpuidle/governors/ladder.c
+++ b/drivers/cpuidle/governors/ladder.c
@@ -79,12 +79,7 @@ static int ladder_select_state(struct cpuidle_driver *drv,
last_state = &ldev->states[last_idx];
- if (!(drv->states[last_idx].flags & CPUIDLE_FLAG_TIME_INVALID)) {
- last_residency = cpuidle_get_last_residency(dev) - \
- drv->states[last_idx].exit_latency;
- }
- else
- last_residency = last_state->threshold.promotion_time + 1;
+ last_residency = cpuidle_get_last_residency(dev) - drv->states[last_idx].exit_latency;
/* consider promotion */
if (last_idx < drv->state_count - 1 &&
--
2.1.2.451.g98349e5
^ permalink raw reply related [flat|nested] 9+ messages in thread* Re: [PATCH 2/3] cpuidle ladder: Better idle duration measurement without using CPUIDLE_FLAG_TIME_INVALID
2014-12-16 6:52 ` [PATCH 2/3] cpuidle ladder: " Len Brown
@ 2014-12-16 11:07 ` Daniel Lezcano
0 siblings, 0 replies; 9+ messages in thread
From: Daniel Lezcano @ 2014-12-16 11:07 UTC (permalink / raw)
To: Len Brown, linux-pm, linux-acpi; +Cc: Len Brown
On 12/16/2014 07:52 AM, Len Brown wrote:
> From: Len Brown <len.brown@intel.com>
>
> When the ladder governor sees the CPUIDLE_FLAG_TIME_INVALID flag,
> it unconditionally causes a state promotion by setting last_residency
> to a number higher than the state's promotion_time:
>
> last_residency = last_state->threshold.promotion_time + 1
>
> It does this for fear that cpuidle_get_last_residency()
> will be in-accurate, because cpuidle_enter_state() invoked
> a state with CPUIDLE_FLAG_TIME_INVALID.
>
> But the only state with CPUIDLE_FLAG_TIME_INVALID is
> acpi_safe_halt(), which may return well after its actual
> idle duration because it enables interrupts, so cpuidle_enter_state()
> also measures interrupt service time.
>
> So what? In ladder, a huge invalid last_residency has exactly
> the same effect as the current code -- it unconditionally
> causes a state promotion.
>
> In the case where the idle residency plus measured interrupt
> handling time is less than the state's demotion_time -- we should
> use that timestamp to give ladder a chance to demote, rather than
> unconditionally promoting.
>
> This can be done by simply ignoring the CPUIDLE_FLAG_TIME_INVALID,
> and using the "invalid" time, as it is either equal to what we are
> doing today, or better.
>
> Signed-off-by: Len Brown <len.brown@intel.com>
> Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
Acked-by: Daniel Lezcano <daniel.lezcano@linaro.org>
a dumb question: is someone still using the ladder governor nowadays ?
> ---
> drivers/cpuidle/governors/ladder.c | 7 +------
> 1 file changed, 1 insertion(+), 6 deletions(-)
>
> diff --git a/drivers/cpuidle/governors/ladder.c b/drivers/cpuidle/governors/ladder.c
> index 37263d9..401c010 100644
> --- a/drivers/cpuidle/governors/ladder.c
> +++ b/drivers/cpuidle/governors/ladder.c
> @@ -79,12 +79,7 @@ static int ladder_select_state(struct cpuidle_driver *drv,
>
> last_state = &ldev->states[last_idx];
>
> - if (!(drv->states[last_idx].flags & CPUIDLE_FLAG_TIME_INVALID)) {
> - last_residency = cpuidle_get_last_residency(dev) - \
> - drv->states[last_idx].exit_latency;
> - }
> - else
> - last_residency = last_state->threshold.promotion_time + 1;
> + last_residency = cpuidle_get_last_residency(dev) - drv->states[last_idx].exit_latency;
>
> /* consider promotion */
> if (last_idx < drv->state_count - 1 &&
>
--
<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-acpi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 3/3] cpuidle, ACPI: remove unused CPUIDLE_FLAG_TIME_INVALID
2014-12-16 6:52 ` [PATCH 1/3] cpuidle menu: Better idle duration measurement without using CPUIDLE_FLAG_TIME_INVALID Len Brown
2014-12-16 6:52 ` [PATCH 2/3] cpuidle ladder: " Len Brown
@ 2014-12-16 6:52 ` Len Brown
2014-12-16 11:08 ` Daniel Lezcano
2014-12-16 10:57 ` [PATCH 1/3] cpuidle menu: Better idle duration measurement without using CPUIDLE_FLAG_TIME_INVALID Daniel Lezcano
2014-12-16 21:09 ` Tuukka Tikkanen
3 siblings, 1 reply; 9+ messages in thread
From: Len Brown @ 2014-12-16 6:52 UTC (permalink / raw)
To: linux-pm, linux-acpi; +Cc: Len Brown, Daniel Lezcano
From: Len Brown <len.brown@intel.com>
CPUIDLE_FLAG_TIME_INVALID is no longer checked
by menu or ladder cpuidle governors, so don't
bother setting or defining it.
It was originally invented to account for the fact that
acpi_safe_halt() enables interrupts to invoke HLT.
That would allow interrupt service routines to be included
in the last_idle duration measurements made in cpuidle_enter_state(),
potentially returning a duration much larger than reality.
But menu and ladder can gracefully handle erroneously large duration
intervals without checking for CPUIDLE_FLAG_TIME_INVALID.
Further, if they don't check CPUIDLE_FLAG_TIME_INVALID, they
can also benefit from the instances when the duration interval
is not erroneously large.
Signed-off-by: Len Brown <len.brown@intel.com>
Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
---
drivers/acpi/processor_idle.c | 2 --
include/linux/cpuidle.h | 3 ---
2 files changed, 5 deletions(-)
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c
index 4995365..87b704e 100644
--- a/drivers/acpi/processor_idle.c
+++ b/drivers/acpi/processor_idle.c
@@ -985,8 +985,6 @@ static int acpi_processor_setup_cpuidle_states(struct acpi_processor *pr)
state->flags = 0;
switch (cx->type) {
case ACPI_STATE_C1:
- if (cx->entry_method != ACPI_CSTATE_FFH)
- state->flags |= CPUIDLE_FLAG_TIME_INVALID;
state->enter = acpi_idle_enter_c1;
state->enter_dead = acpi_idle_play_dead;
diff --git a/include/linux/cpuidle.h b/include/linux/cpuidle.h
index a07e087..ab70f3b 100644
--- a/include/linux/cpuidle.h
+++ b/include/linux/cpuidle.h
@@ -53,7 +53,6 @@ struct cpuidle_state {
};
/* Idle State Flags */
-#define CPUIDLE_FLAG_TIME_INVALID (0x01) /* is residency time measurable? */
#define CPUIDLE_FLAG_COUPLED (0x02) /* state applies to multiple cpus */
#define CPUIDLE_FLAG_TIMER_STOP (0x04) /* timer is stopped on this state */
@@ -89,8 +88,6 @@ DECLARE_PER_CPU(struct cpuidle_device, cpuidle_dev);
/**
* cpuidle_get_last_residency - retrieves the last state's residency time
* @dev: the target CPU
- *
- * NOTE: this value is invalid if CPUIDLE_FLAG_TIME_INVALID is set
*/
static inline int cpuidle_get_last_residency(struct cpuidle_device *dev)
{
--
2.1.2.451.g98349e5
^ permalink raw reply related [flat|nested] 9+ messages in thread* Re: [PATCH 3/3] cpuidle, ACPI: remove unused CPUIDLE_FLAG_TIME_INVALID
2014-12-16 6:52 ` [PATCH 3/3] cpuidle, ACPI: remove unused CPUIDLE_FLAG_TIME_INVALID Len Brown
@ 2014-12-16 11:08 ` Daniel Lezcano
2014-12-17 0:28 ` Rafael J. Wysocki
0 siblings, 1 reply; 9+ messages in thread
From: Daniel Lezcano @ 2014-12-16 11:08 UTC (permalink / raw)
To: Len Brown, linux-pm, linux-acpi; +Cc: Len Brown
On 12/16/2014 07:52 AM, Len Brown wrote:
> From: Len Brown <len.brown@intel.com>
>
> CPUIDLE_FLAG_TIME_INVALID is no longer checked
> by menu or ladder cpuidle governors, so don't
> bother setting or defining it.
>
> It was originally invented to account for the fact that
> acpi_safe_halt() enables interrupts to invoke HLT.
> That would allow interrupt service routines to be included
> in the last_idle duration measurements made in cpuidle_enter_state(),
> potentially returning a duration much larger than reality.
>
> But menu and ladder can gracefully handle erroneously large duration
> intervals without checking for CPUIDLE_FLAG_TIME_INVALID.
> Further, if they don't check CPUIDLE_FLAG_TIME_INVALID, they
> can also benefit from the instances when the duration interval
> is not erroneously large.
>
> Signed-off-by: Len Brown <len.brown@intel.com>
> Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
Acked-by: Daniel Lezcano <daniel.lezcano@linaro.org>
> ---
> drivers/acpi/processor_idle.c | 2 --
> include/linux/cpuidle.h | 3 ---
> 2 files changed, 5 deletions(-)
>
> diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c
> index 4995365..87b704e 100644
> --- a/drivers/acpi/processor_idle.c
> +++ b/drivers/acpi/processor_idle.c
> @@ -985,8 +985,6 @@ static int acpi_processor_setup_cpuidle_states(struct acpi_processor *pr)
> state->flags = 0;
> switch (cx->type) {
> case ACPI_STATE_C1:
> - if (cx->entry_method != ACPI_CSTATE_FFH)
> - state->flags |= CPUIDLE_FLAG_TIME_INVALID;
>
> state->enter = acpi_idle_enter_c1;
> state->enter_dead = acpi_idle_play_dead;
> diff --git a/include/linux/cpuidle.h b/include/linux/cpuidle.h
> index a07e087..ab70f3b 100644
> --- a/include/linux/cpuidle.h
> +++ b/include/linux/cpuidle.h
> @@ -53,7 +53,6 @@ struct cpuidle_state {
> };
>
> /* Idle State Flags */
> -#define CPUIDLE_FLAG_TIME_INVALID (0x01) /* is residency time measurable? */
> #define CPUIDLE_FLAG_COUPLED (0x02) /* state applies to multiple cpus */
> #define CPUIDLE_FLAG_TIMER_STOP (0x04) /* timer is stopped on this state */
>
> @@ -89,8 +88,6 @@ DECLARE_PER_CPU(struct cpuidle_device, cpuidle_dev);
> /**
> * cpuidle_get_last_residency - retrieves the last state's residency time
> * @dev: the target CPU
> - *
> - * NOTE: this value is invalid if CPUIDLE_FLAG_TIME_INVALID is set
> */
> static inline int cpuidle_get_last_residency(struct cpuidle_device *dev)
> {
>
--
<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] 9+ messages in thread* Re: [PATCH 3/3] cpuidle, ACPI: remove unused CPUIDLE_FLAG_TIME_INVALID
2014-12-16 11:08 ` Daniel Lezcano
@ 2014-12-17 0:28 ` Rafael J. Wysocki
0 siblings, 0 replies; 9+ messages in thread
From: Rafael J. Wysocki @ 2014-12-17 0:28 UTC (permalink / raw)
To: Daniel Lezcano; +Cc: Len Brown, linux-pm, linux-acpi, Len Brown
On Tuesday, December 16, 2014 12:08:25 PM Daniel Lezcano wrote:
> On 12/16/2014 07:52 AM, Len Brown wrote:
> > From: Len Brown <len.brown@intel.com>
> >
> > CPUIDLE_FLAG_TIME_INVALID is no longer checked
> > by menu or ladder cpuidle governors, so don't
> > bother setting or defining it.
> >
> > It was originally invented to account for the fact that
> > acpi_safe_halt() enables interrupts to invoke HLT.
> > That would allow interrupt service routines to be included
> > in the last_idle duration measurements made in cpuidle_enter_state(),
> > potentially returning a duration much larger than reality.
> >
> > But menu and ladder can gracefully handle erroneously large duration
> > intervals without checking for CPUIDLE_FLAG_TIME_INVALID.
> > Further, if they don't check CPUIDLE_FLAG_TIME_INVALID, they
> > can also benefit from the instances when the duration interval
> > is not erroneously large.
> >
> > Signed-off-by: Len Brown <len.brown@intel.com>
> > Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
>
> Acked-by: Daniel Lezcano <daniel.lezcano@linaro.org>
OK
Since the material for my next pull request is staged already, I'm going to
queue up this series for 3.19-rc, but I'll most likely push it for -rc2.
Thanks!
> > ---
> > drivers/acpi/processor_idle.c | 2 --
> > include/linux/cpuidle.h | 3 ---
> > 2 files changed, 5 deletions(-)
> >
> > diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c
> > index 4995365..87b704e 100644
> > --- a/drivers/acpi/processor_idle.c
> > +++ b/drivers/acpi/processor_idle.c
> > @@ -985,8 +985,6 @@ static int acpi_processor_setup_cpuidle_states(struct acpi_processor *pr)
> > state->flags = 0;
> > switch (cx->type) {
> > case ACPI_STATE_C1:
> > - if (cx->entry_method != ACPI_CSTATE_FFH)
> > - state->flags |= CPUIDLE_FLAG_TIME_INVALID;
> >
> > state->enter = acpi_idle_enter_c1;
> > state->enter_dead = acpi_idle_play_dead;
> > diff --git a/include/linux/cpuidle.h b/include/linux/cpuidle.h
> > index a07e087..ab70f3b 100644
> > --- a/include/linux/cpuidle.h
> > +++ b/include/linux/cpuidle.h
> > @@ -53,7 +53,6 @@ struct cpuidle_state {
> > };
> >
> > /* Idle State Flags */
> > -#define CPUIDLE_FLAG_TIME_INVALID (0x01) /* is residency time measurable? */
> > #define CPUIDLE_FLAG_COUPLED (0x02) /* state applies to multiple cpus */
> > #define CPUIDLE_FLAG_TIMER_STOP (0x04) /* timer is stopped on this state */
> >
> > @@ -89,8 +88,6 @@ DECLARE_PER_CPU(struct cpuidle_device, cpuidle_dev);
> > /**
> > * cpuidle_get_last_residency - retrieves the last state's residency time
> > * @dev: the target CPU
> > - *
> > - * NOTE: this value is invalid if CPUIDLE_FLAG_TIME_INVALID is set
> > */
> > static inline int cpuidle_get_last_residency(struct cpuidle_device *dev)
> > {
> >
>
>
>
--
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/3] cpuidle menu: Better idle duration measurement without using CPUIDLE_FLAG_TIME_INVALID
2014-12-16 6:52 ` [PATCH 1/3] cpuidle menu: Better idle duration measurement without using CPUIDLE_FLAG_TIME_INVALID Len Brown
2014-12-16 6:52 ` [PATCH 2/3] cpuidle ladder: " Len Brown
2014-12-16 6:52 ` [PATCH 3/3] cpuidle, ACPI: remove unused CPUIDLE_FLAG_TIME_INVALID Len Brown
@ 2014-12-16 10:57 ` Daniel Lezcano
2014-12-16 21:09 ` Tuukka Tikkanen
3 siblings, 0 replies; 9+ messages in thread
From: Daniel Lezcano @ 2014-12-16 10:57 UTC (permalink / raw)
To: Len Brown, linux-pm, linux-acpi; +Cc: Len Brown
On 12/16/2014 07:52 AM, Len Brown wrote:
> From: Len Brown <len.brown@intel.com>
>
> When menu sees CPUIDLE_FLAG_TIME_INVALID, it ignores its timestamps,
> and assumes that idle lasted as long as the time till next predicted
> timer expiration.
>
> But if an interrupt was seen and serviced before that duration,
> it would actually be more accurate to use the measured time
> rather than rounding up to the next predicted timer expiration.
>
> And if an interrupt is seen and serviced such that the mesured time
> exceeds the time till next predicted timer expiration, then
> truncating to that expiration is the right thing to do --
> since we can never stay idle past that timer expiration.
>
> So the code can do a better job without
> checking for CPUIDLE_FLAG_TIME_INVALID.
Good point.
Acked-by: Daniel Lezcano <daniel.lezcano@linaro.org>
> Signed-off-by: Len Brown <len.brown@intel.com>
> Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
> ---
> drivers/cpuidle/governors/menu.c | 25 ++++++++++---------------
> 1 file changed, 10 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/cpuidle/governors/menu.c b/drivers/cpuidle/governors/menu.c
> index 659d7b0..4058079 100644
> --- a/drivers/cpuidle/governors/menu.c
> +++ b/drivers/cpuidle/governors/menu.c
> @@ -396,8 +396,8 @@ static void menu_update(struct cpuidle_driver *drv, struct cpuidle_device *dev)
> * power state and occurrence of the wakeup event.
> *
> * If the entered idle state didn't support residency measurements,
> - * we are basically lost in the dark how much time passed.
> - * As a compromise, assume we slept for the whole expected time.
> + * we use them anyway if they are short, and if long,
> + * truncate to the whole expected time.
> *
> * Any measured amount of time will include the exit latency.
> * Since we are interested in when the wakeup begun, not when it
> @@ -405,22 +405,17 @@ static void menu_update(struct cpuidle_driver *drv, struct cpuidle_device *dev)
> * the measured amount of time is less than the exit latency,
> * assume the state was never reached and the exit latency is 0.
> */
> - if (unlikely(target->flags & CPUIDLE_FLAG_TIME_INVALID)) {
> - /* Use timer value as is */
> - measured_us = data->next_timer_us;
>
> - } else {
> - /* Use measured value */
> - measured_us = cpuidle_get_last_residency(dev);
> + /* measured value */
> + measured_us = cpuidle_get_last_residency(dev);
>
> - /* Deduct exit latency */
> - if (measured_us > target->exit_latency)
> - measured_us -= target->exit_latency;
> + /* Deduct exit latency */
> + if (measured_us > target->exit_latency)
> + measured_us -= target->exit_latency;
>
> - /* Make sure our coefficients do not exceed unity */
> - if (measured_us > data->next_timer_us)
> - measured_us = data->next_timer_us;
> - }
> + /* Make sure our coefficients do not exceed unity */
> + if (measured_us > data->next_timer_us)
> + measured_us = data->next_timer_us;
>
> /* Update our correction ratio */
> new_factor = data->correction_factor[data->bucket];
>
--
<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] 9+ messages in thread* Re: [PATCH 1/3] cpuidle menu: Better idle duration measurement without using CPUIDLE_FLAG_TIME_INVALID
2014-12-16 6:52 ` [PATCH 1/3] cpuidle menu: Better idle duration measurement without using CPUIDLE_FLAG_TIME_INVALID Len Brown
` (2 preceding siblings ...)
2014-12-16 10:57 ` [PATCH 1/3] cpuidle menu: Better idle duration measurement without using CPUIDLE_FLAG_TIME_INVALID Daniel Lezcano
@ 2014-12-16 21:09 ` Tuukka Tikkanen
3 siblings, 0 replies; 9+ messages in thread
From: Tuukka Tikkanen @ 2014-12-16 21:09 UTC (permalink / raw)
To: Len Brown; +Cc: Linux PM list, linux-acpi, Len Brown, Daniel Lezcano
On Tue, Dec 16, 2014 at 8:52 AM, Len Brown <lenb@kernel.org> wrote:
> From: Len Brown <len.brown@intel.com>
>
> When menu sees CPUIDLE_FLAG_TIME_INVALID, it ignores its timestamps,
> and assumes that idle lasted as long as the time till next predicted
> timer expiration.
>
> But if an interrupt was seen and serviced before that duration,
> it would actually be more accurate to use the measured time
> rather than rounding up to the next predicted timer expiration.
>
> And if an interrupt is seen and serviced such that the mesured time
> exceeds the time till next predicted timer expiration, then
> truncating to that expiration is the right thing to do --
> since we can never stay idle past that timer expiration.
>
> So the code can do a better job without
> checking for CPUIDLE_FLAG_TIME_INVALID.
>
> Signed-off-by: Len Brown <len.brown@intel.com>
> Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
Reviewed-by: Tuukka Tikkanen <tuukka.tikkanen@linaro.org>
> ---
> drivers/cpuidle/governors/menu.c | 25 ++++++++++---------------
> 1 file changed, 10 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/cpuidle/governors/menu.c b/drivers/cpuidle/governors/menu.c
> index 659d7b0..4058079 100644
> --- a/drivers/cpuidle/governors/menu.c
> +++ b/drivers/cpuidle/governors/menu.c
> @@ -396,8 +396,8 @@ static void menu_update(struct cpuidle_driver *drv, struct cpuidle_device *dev)
> * power state and occurrence of the wakeup event.
> *
> * If the entered idle state didn't support residency measurements,
> - * we are basically lost in the dark how much time passed.
> - * As a compromise, assume we slept for the whole expected time.
> + * we use them anyway if they are short, and if long,
> + * truncate to the whole expected time.
> *
> * Any measured amount of time will include the exit latency.
> * Since we are interested in when the wakeup begun, not when it
> @@ -405,22 +405,17 @@ static void menu_update(struct cpuidle_driver *drv, struct cpuidle_device *dev)
> * the measured amount of time is less than the exit latency,
> * assume the state was never reached and the exit latency is 0.
> */
> - if (unlikely(target->flags & CPUIDLE_FLAG_TIME_INVALID)) {
> - /* Use timer value as is */
> - measured_us = data->next_timer_us;
>
> - } else {
> - /* Use measured value */
> - measured_us = cpuidle_get_last_residency(dev);
> + /* measured value */
> + measured_us = cpuidle_get_last_residency(dev);
>
> - /* Deduct exit latency */
> - if (measured_us > target->exit_latency)
> - measured_us -= target->exit_latency;
> + /* Deduct exit latency */
> + if (measured_us > target->exit_latency)
> + measured_us -= target->exit_latency;
>
> - /* Make sure our coefficients do not exceed unity */
> - if (measured_us > data->next_timer_us)
> - measured_us = data->next_timer_us;
> - }
> + /* Make sure our coefficients do not exceed unity */
> + if (measured_us > data->next_timer_us)
> + measured_us = data->next_timer_us;
>
> /* Update our correction ratio */
> new_factor = data->correction_factor[data->bucket];
> --
> 2.1.2.451.g98349e5
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-pm" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 9+ messages in thread