From: Philippe Longepe <philippe.longepe@linux.intel.com>
To: linux-pm@vger.kernel.org
Cc: srinivas.pandruvada@linux.intel.com,
Stephane Gasparini <stephane.gasparini@intel.com>,
Philippe Longepe <philippe.longepe@intel.com>
Subject: [PATCH V5 3/3] cpufreq: intel_pstate: Account for IO wait time
Date: Thu, 3 Dec 2015 18:55:59 +0100 [thread overview]
Message-ID: <1449165359-25832-8-git-send-email-philippe.longepe@linux.intel.com> (raw)
In-Reply-To: <1449165359-25832-1-git-send-email-philippe.longepe@linux.intel.com>
From: Stephane Gasparini <stephane.gasparini@intel.com>
To improve IO bound work, account IO wait time in calculating
CPU busy. This change gets IO wait time using get_cpu_iowait_time_us,
and converts time into number of IO cycles spent at max non turbo
frequency. This IO cycle count is added to mperf value to account
for IO wait time.
Signed-off-by: Philippe Longepe <philippe.longepe@intel.com>
Signed-off-by: Stephane Gasparini <stephane.gasparini@intel.com>
---
drivers/cpufreq/intel_pstate.c | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c
index 2cf8bb6..fb92402 100644
--- a/drivers/cpufreq/intel_pstate.c
+++ b/drivers/cpufreq/intel_pstate.c
@@ -114,6 +114,7 @@ struct cpudata {
u64 prev_mperf;
u64 prev_tsc;
struct sample sample;
+ u64 prev_cummulative_iowait;
};
static struct cpudata **all_cpu_data;
@@ -934,16 +935,28 @@ static inline void intel_pstate_set_sample_time(struct cpudata *cpu)
static inline int32_t get_target_pstate_use_cpu_load(struct cpudata *cpu)
{
struct sample *sample = &cpu->sample;
+ u64 cummulative_iowait, delta_iowait_us;
+ u64 delta_iowait_mperf;
+ u64 mperf, now;
int32_t cpu_load;
+ cummulative_iowait = get_cpu_iowait_time_us(cpu->cpu, &now);
+
+ /* Convert iowait time into number of IO cycles spent at max_freq */
+ delta_iowait_us = cummulative_iowait - cpu->prev_cummulative_iowait;
+ delta_iowait_mperf = div64_u64(delta_iowait_us * cpu->pstate.scaling *
+ cpu->pstate.max_pstate, 1000);
+
+ mperf = cpu->sample.mperf + delta_iowait_mperf;
+ cpu->prev_cummulative_iowait = cummulative_iowait;
+
/*
* The load can be estimated as the ratio of the mperf counter
* running at a constant frequency during active periods
* (C0) and the time stamp counter running at the same frequency
* also during C-states.
*/
- cpu_load = div64_u64(100 * sample->mperf, sample->tsc);
-
+ cpu_load = div64_u64(100 * mperf, sample->tsc);
cpu->sample.busy_scaled = int_tofp(cpu_load);
return (cpu->pstate.current_pstate - pid_calc(&cpu->pid,
--
1.9.1
prev parent reply other threads:[~2015-12-03 17:55 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-03 17:55 [PATCH V5 0/3] cpufreq: intel_pstate: account non C0 time Philippe Longepe
2015-12-03 17:55 ` Philippe Longepe
2015-12-03 17:55 ` [PATCH V5 1/3] cpufreq: intel_pstate: configurable algorithm to get target pstate Philippe Longepe
2015-12-04 1:41 ` Rafael J. Wysocki
2015-12-03 17:55 ` Philippe Longepe
2015-12-03 17:55 ` [PATCH V5 2/3] cpufreq: intel_pstate: account for non C0 time Philippe Longepe
2015-12-04 2:12 ` Rafael J. Wysocki
2015-12-04 14:33 ` Philippe Longepe
2015-12-04 17:39 ` Srinivas Pandruvada
2015-12-04 23:01 ` Rafael J. Wysocki
2015-12-04 22:48 ` Srinivas Pandruvada
2015-12-04 23:16 ` Rafael J. Wysocki
2015-12-03 17:55 ` Philippe Longepe
2015-12-03 17:55 ` [PATCH V5 3/3] cpufreq: intel_pstate: Account for IO wait time Philippe Longepe
2015-12-04 2:27 ` Rafael J. Wysocki
2015-12-03 17:55 ` Philippe Longepe [this message]
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=1449165359-25832-8-git-send-email-philippe.longepe@linux.intel.com \
--to=philippe.longepe@linux.intel.com \
--cc=linux-pm@vger.kernel.org \
--cc=philippe.longepe@intel.com \
--cc=srinivas.pandruvada@linux.intel.com \
--cc=stephane.gasparini@intel.com \
/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.