linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Daniel Lezcano <daniel.lezcano@linaro.org>
To: Len Brown <lenb@kernel.org>,
	linux-pm@vger.kernel.org, linux-acpi@vger.kernel.org
Cc: Len Brown <len.brown@intel.com>
Subject: Re: [PATCH 2/3] cpuidle ladder: Better idle duration measurement without using CPUIDLE_FLAG_TIME_INVALID
Date: Tue, 16 Dec 2014 12:07:52 +0100	[thread overview]
Message-ID: <54901288.7000006@linaro.org> (raw)
In-Reply-To: <83e27d4a9f387aa9781de927ea7f436f388de7bd.1418712225.git.len.brown@intel.com>

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

  reply	other threads:[~2014-12-16 11:07 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-16  6:52 cpuidle: remove CPUIDLE_FLAG_TIME_INVALID Len Brown
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 11:07     ` Daniel Lezcano [this message]
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
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

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=54901288.7000006@linaro.org \
    --to=daniel.lezcano@linaro.org \
    --cc=len.brown@intel.com \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-pm@vger.kernel.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).