From: venkatesh.pallipadi@intel.com
To: cpufreq@www.linux.org.uk
Cc: davej@redhat.com
Subject: [patch 3/6] cpufreq: get_cpu_idle_time() changes in ondemand to suit idle-microaccounting
Date: Thu, 17 Jul 2008 13:55:57 -0700 [thread overview]
Message-ID: <20080717205616.230872000@intel.com> (raw)
In-Reply-To: 20080717205554.214645000@intel.com
[-- Attachment #1: prepare_idle_microaccounting.patch --]
[-- Type: text/plain, Size: 3121 bytes --]
Preparatory changes for doing idle micro-accounting in ondemand governor.
get_cpu_idle_time() gets extra parameter and returns idle time and also the
wall time that corresponds to the idle time measurement.
Signed-off-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
---
drivers/cpufreq/cpufreq_ondemand.c | 29 +++++++++++++++--------------
1 file changed, 15 insertions(+), 14 deletions(-)
Index: linux-2.6/drivers/cpufreq/cpufreq_ondemand.c
===================================================================
--- linux-2.6.orig/drivers/cpufreq/cpufreq_ondemand.c 2008-07-17 13:05:51.000000000 -0700
+++ linux-2.6/drivers/cpufreq/cpufreq_ondemand.c 2008-07-17 13:12:26.000000000 -0700
@@ -94,13 +94,13 @@ static struct dbs_tuners {
.powersave_bias = 0,
};
-static inline cputime64_t get_cpu_idle_time(unsigned int cpu)
+static inline cputime64_t get_cpu_idle_time(unsigned int cpu, cputime64_t *wall)
{
cputime64_t idle_time;
- cputime64_t cur_jiffies;
+ cputime64_t cur_wall_time;
cputime64_t busy_time;
- cur_jiffies = jiffies64_to_cputime64(get_jiffies_64());
+ cur_wall_time = jiffies64_to_cputime64(get_jiffies_64());
busy_time = cputime64_add(kstat_cpu(cpu).cpustat.user,
kstat_cpu(cpu).cpustat.system);
@@ -113,7 +113,10 @@ static inline cputime64_t get_cpu_idle_t
kstat_cpu(cpu).cpustat.nice);
}
- idle_time = cputime64_sub(cur_jiffies, busy_time);
+ idle_time = cputime64_sub(cur_wall_time, busy_time);
+ if (wall)
+ *wall = cur_wall_time;
+
return idle_time;
}
@@ -277,8 +280,8 @@ static ssize_t store_ignore_nice_load(st
for_each_online_cpu(j) {
struct cpu_dbs_info_s *dbs_info;
dbs_info = &per_cpu(cpu_dbs_info, j);
- dbs_info->prev_cpu_idle = get_cpu_idle_time(j);
- dbs_info->prev_cpu_wall = get_jiffies_64();
+ dbs_info->prev_cpu_idle = get_cpu_idle_time(j,
+ &dbs_info->prev_cpu_wall);
}
mutex_unlock(&dbs_mutex);
@@ -368,21 +371,19 @@ static void dbs_check_cpu(struct cpu_dbs
int freq_avg;
j_dbs_info = &per_cpu(cpu_dbs_info, j);
- cur_wall_time = jiffies64_to_cputime64(get_jiffies_64());
+
+ cur_idle_time = get_cpu_idle_time(j, &cur_wall_time);
+
wall_time = (unsigned int) cputime64_sub(cur_wall_time,
j_dbs_info->prev_cpu_wall);
j_dbs_info->prev_cpu_wall = cur_wall_time;
- cur_idle_time = get_cpu_idle_time(j);
idle_time = (unsigned int) cputime64_sub(cur_idle_time,
j_dbs_info->prev_cpu_idle);
j_dbs_info->prev_cpu_idle = cur_idle_time;
- if (unlikely(wall_time <= idle_time ||
- (cputime_to_msecs(wall_time) <
- dbs_tuners_ins.sampling_rate / (2 * 1000)))) {
+ if (unlikely(!wall_time || wall_time < idle_time))
continue;
- }
load = 100 * (wall_time - idle_time) / wall_time;
@@ -531,8 +532,8 @@ static int cpufreq_governor_dbs(struct c
j_dbs_info = &per_cpu(cpu_dbs_info, j);
j_dbs_info->cur_policy = policy;
- j_dbs_info->prev_cpu_idle = get_cpu_idle_time(j);
- j_dbs_info->prev_cpu_wall = get_jiffies_64();
+ j_dbs_info->prev_cpu_idle = get_cpu_idle_time(j,
+ &j_dbs_info->prev_cpu_wall);
}
this_dbs_info->cpu = cpu;
/*
--
next prev parent reply other threads:[~2008-07-17 20:55 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-17 20:55 [patch 0/6] cpufreq: Use idle micro-accounting information in ondemand governor venkatesh.pallipadi
2008-07-17 20:55 ` [patch 1/6] cpufreq: Add cpu number parameter to __cpufreq_driver_getavg() venkatesh.pallipadi
2008-07-17 20:55 ` [patch 2/6] cpufreq: Change load calculation in ondemand for software coordination venkatesh.pallipadi
2008-07-17 20:55 ` venkatesh.pallipadi [this message]
2008-07-17 20:55 ` [patch 4/6] cpufreq_ondemand: Parameterize down differential venkatesh.pallipadi
2008-07-17 20:55 ` [patch 5/6] cpufreq: Changes to get_cpu_idle_time_us(), to be used in ondemand governor venkatesh.pallipadi
2008-07-17 20:56 ` [patch 6/6] cpufreq: Add idle microaccounting " venkatesh.pallipadi
2008-07-30 16:56 ` [patch 0/6] cpufreq: Use idle micro-accounting information " Dave Jones
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=20080717205616.230872000@intel.com \
--to=venkatesh.pallipadi@intel.com \
--cc=cpufreq@www.linux.org.uk \
--cc=davej@redhat.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 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).