From: "Rafael J. Wysocki" <rjw@rjwysocki.net>
To: Aubrey Li <aubrey.li@intel.com>
Cc: tglx@linutronix.de, peterz@infradead.org, len.brown@intel.com,
ak@linux.intel.com, tim.c.chen@linux.intel.com, x86@kernel.org,
linux-kernel@vger.kernel.org,
Aubrey Li <aubrey.li@linux.intel.com>
Subject: Re: [RFC PATCH v2 7/8] cpuidle: introduce irq timing to make idle prediction
Date: Sat, 14 Oct 2017 03:01:28 +0200 [thread overview]
Message-ID: <1759699.pn1NT78COC@aspire.rjw.lan> (raw)
In-Reply-To: <1506756034-6340-8-git-send-email-aubrey.li@intel.com>
On Saturday, September 30, 2017 9:20:33 AM CEST Aubrey Li wrote:
> Introduce irq timings output as a factor to predict the duration
> of the coming idle
>
> Signed-off-by: Aubrey Li <aubrey.li@linux.intel.com>
> ---
> drivers/cpuidle/Kconfig | 1 +
> drivers/cpuidle/cpuidle.c | 17 ++++++++++++++++-
> 2 files changed, 17 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/cpuidle/Kconfig b/drivers/cpuidle/Kconfig
> index 7e48eb5..8b07e1c 100644
> --- a/drivers/cpuidle/Kconfig
> +++ b/drivers/cpuidle/Kconfig
> @@ -5,6 +5,7 @@ config CPU_IDLE
> default y if ACPI || PPC_PSERIES
> select CPU_IDLE_GOV_LADDER if (!NO_HZ && !NO_HZ_IDLE)
> select CPU_IDLE_GOV_MENU if (NO_HZ || NO_HZ_IDLE)
> + select IRQ_TIMINGS
> help
> CPU idle is a generic framework for supporting software-controlled
> idle processor power management. It includes modular cross-platform
> diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c
> index 5d4f0b6..be56cea 100644
> --- a/drivers/cpuidle/cpuidle.c
> +++ b/drivers/cpuidle/cpuidle.c
> @@ -22,6 +22,7 @@
> #include <linux/module.h>
> #include <linux/suspend.h>
> #include <linux/tick.h>
> +#include <linux/interrupt.h>
> #include <trace/events/power.h>
>
> #include "cpuidle.h"
> @@ -342,13 +343,27 @@ void cpuidle_entry_end(void)
> void cpuidle_predict(void)
> {
> struct cpuidle_device *dev = cpuidle_get_device();
> - unsigned int overhead_threshold;
> + unsigned int idle_interval, overhead_threshold;
> + u64 now, next_evt;
>
> if (!dev)
> return;
>
> overhead_threshold = dev->idle_stat.overhead * sysctl_fast_idle_ratio;
>
> + /*
> + * check irq timings if the next event is coming soon
> + */
> + now = local_clock();
> + local_irq_disable();
> + next_evt = irq_timings_next_event(now);
> + local_irq_enable();
> + idle_interval = div_u64(next_evt - now, NSEC_PER_USEC);
Another division ...
> + if (idle_interval < overhead_threshold) {
> + dev->idle_stat.fast_idle = true;
> + return;
> + }
> +
> if (cpuidle_curr_governor->predict) {
> dev->idle_stat.predicted_us = cpuidle_curr_governor->predict();
> /*
>
next prev parent reply other threads:[~2017-10-14 1:11 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-30 7:20 [RFC PATCH v2 0/8] Introduct cpu idle prediction functionality Aubrey Li
2017-09-30 7:20 ` [RFC PATCH v2 1/8] cpuidle: menu: extract " Aubrey Li
2017-10-14 0:26 ` Rafael J. Wysocki
2017-10-16 2:46 ` Li, Aubrey
2017-09-30 7:20 ` [RFC PATCH v2 2/8] cpuidle: record the overhead of idle entry Aubrey Li
2017-10-14 0:35 ` Rafael J. Wysocki
2017-10-16 3:11 ` Li, Aubrey
2017-10-17 0:05 ` Rafael J. Wysocki
2017-10-17 7:04 ` Li, Aubrey
2017-09-30 7:20 ` [RFC PATCH v2 3/8] cpuidle: add a new predict interface Aubrey Li
2017-10-14 0:45 ` Rafael J. Wysocki
2017-10-16 8:04 ` Li, Aubrey
2017-10-14 1:27 ` Rafael J. Wysocki
2017-10-16 9:52 ` Li, Aubrey
2017-09-30 7:20 ` [RFC PATCH v2 4/8] tick/nohz: keep tick on for a fast idle Aubrey Li
2017-10-14 0:51 ` Rafael J. Wysocki
2017-10-16 3:26 ` Li, Aubrey
2017-10-16 4:45 ` Mike Galbraith
2017-10-16 5:34 ` Li, Aubrey
2017-10-16 6:25 ` Mike Galbraith
2017-10-16 6:31 ` Li, Aubrey
2017-09-30 7:20 ` [RFC PATCH v2 5/8] timers: keep sleep length updated as needed Aubrey Li
2017-10-14 0:56 ` Rafael J. Wysocki
2017-10-16 6:46 ` Li, Aubrey
2017-10-16 23:58 ` Rafael J. Wysocki
2017-10-17 6:10 ` Li, Aubrey
2017-09-30 7:20 ` [RFC PATCH v2 6/8] cpuidle: make fast idle threshold tunable Aubrey Li
2017-10-14 0:59 ` Rafael J. Wysocki
2017-10-16 6:00 ` Li, Aubrey
2017-10-17 0:01 ` Rafael J. Wysocki
2017-10-17 6:12 ` Li, Aubrey
2017-09-30 7:20 ` [RFC PATCH v2 7/8] cpuidle: introduce irq timing to make idle prediction Aubrey Li
2017-10-14 1:01 ` Rafael J. Wysocki [this message]
2017-10-16 6:03 ` Li, Aubrey
2017-09-30 7:20 ` [RFC PATCH v2 8/8] cpuidle: introduce run queue average idle " Aubrey Li
2017-10-14 1:02 ` Rafael J. Wysocki
2017-10-14 1:14 ` [RFC PATCH v2 0/8] Introduct cpu idle prediction functionality Rafael J. Wysocki
2017-10-16 7:44 ` Li, Aubrey
2017-10-17 0:07 ` Rafael J. Wysocki
2017-10-17 7:32 ` Li, Aubrey
2017-11-30 1:00 ` Li, Aubrey
2017-11-30 1:37 ` Rafael J. Wysocki
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=1759699.pn1NT78COC@aspire.rjw.lan \
--to=rjw@rjwysocki.net \
--cc=ak@linux.intel.com \
--cc=aubrey.li@intel.com \
--cc=aubrey.li@linux.intel.com \
--cc=len.brown@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
--cc=tim.c.chen@linux.intel.com \
--cc=x86@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.