From: Greg KH <gregkh@suse.de>
To: linux-kernel@vger.kernel.org, stable@kernel.org
Cc: Justin Forbes <jmforbes@linuxtx.org>,
Zwane Mwaikambo <zwane@arm.linux.org.uk>,
"Theodore Ts'o" <tytso@mit.edu>,
Randy Dunlap <rdunlap@xenotime.net>,
Dave Jones <davej@redhat.com>,
Chuck Wolber <chuckw@quantumlinux.com>,
Chris Wedgwood <reviews@ml.cw.f00f.org>,
Michael Krufky <mkrufky@linuxtv.org>,
Chuck Ebbert <cebbert@redhat.com>,
Domenico Andreoli <cavokz@gmail.com>,
torvalds@linux-foundation.org, akpm@linux-foundation.org,
alan@lxorguk.ukuu.org.uk,
Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Subject: [patch 11/12] CPUFREQ: ondemand: fix tickless accounting and software coordination bug
Date: Tue, 14 Aug 2007 00:29:40 -0700 [thread overview]
Message-ID: <20070814072940.GK15025@kroah.com> (raw)
In-Reply-To: <20070814072813.GA15025@kroah.com>
[-- Attachment #1: cpufreq-ondemand-fix-tickless-accounting-and-software-coordination-bug.patch --]
[-- Type: text/plain, Size: 2523 bytes --]
-stable review patch. If anyone has any objections, please let us know.
------------------
From: Venki Pallipadi <venkatesh.pallipadi@intel.com>
With tickless kernel and software coordination os P-states, ondemand
can look at wrong idle statistics. This can happen when ondemand sampling
is happening on CPU 0 and due to software coordination sampling also looks at
utilization of CPU 1. If CPU 1 is in tickless state at that moment, its idle
statistics will not be uptodate and CPU 0 thinks CPU 1 is idle for less
amount of time than it actually is.
This can be resolved by looking at all the busy times of CPUs, which is
accurate, even with tickless, and use that to determine idle time in a
round about way (total time - busy time).
Thanks to Arjan for originally reporting the ondemand bug on
Lenovo T61.
Signed-off-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Signed-off-by: Dave Jones <davej@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
drivers/cpufreq/cpufreq_ondemand.c | 25 ++++++++++++++++++-------
1 file changed, 18 insertions(+), 7 deletions(-)
--- a/drivers/cpufreq/cpufreq_ondemand.c
+++ b/drivers/cpufreq/cpufreq_ondemand.c
@@ -96,15 +96,25 @@ static struct dbs_tuners {
static inline cputime64_t get_cpu_idle_time(unsigned int cpu)
{
- cputime64_t retval;
+ cputime64_t idle_time;
+ cputime64_t cur_jiffies;
+ cputime64_t busy_time;
- retval = cputime64_add(kstat_cpu(cpu).cpustat.idle,
- kstat_cpu(cpu).cpustat.iowait);
+ cur_jiffies = jiffies64_to_cputime64(get_jiffies_64());
+ busy_time = cputime64_add(kstat_cpu(cpu).cpustat.user,
+ kstat_cpu(cpu).cpustat.system);
- if (dbs_tuners_ins.ignore_nice)
- retval = cputime64_add(retval, kstat_cpu(cpu).cpustat.nice);
+ busy_time = cputime64_add(busy_time, kstat_cpu(cpu).cpustat.irq);
+ busy_time = cputime64_add(busy_time, kstat_cpu(cpu).cpustat.softirq);
+ busy_time = cputime64_add(busy_time, kstat_cpu(cpu).cpustat.steal);
- return retval;
+ if (!dbs_tuners_ins.ignore_nice) {
+ busy_time = cputime64_add(busy_time,
+ kstat_cpu(cpu).cpustat.nice);
+ }
+
+ idle_time = cputime64_sub(cur_jiffies, busy_time);
+ return idle_time;
}
/*
@@ -339,7 +349,8 @@ static void dbs_check_cpu(struct cpu_dbs
cur_jiffies = jiffies64_to_cputime64(get_jiffies_64());
total_ticks = (unsigned int) cputime64_sub(cur_jiffies,
this_dbs_info->prev_cpu_wall);
- this_dbs_info->prev_cpu_wall = cur_jiffies;
+ this_dbs_info->prev_cpu_wall = get_jiffies_64();
+
if (!total_ticks)
return;
/*
--
next prev parent reply other threads:[~2007-08-14 7:53 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20070814072244.882283903@mini.kroah.org>
2007-08-14 7:28 ` [patch 00/12] 2.6.22-stable review Greg KH
2007-08-14 7:28 ` [patch 01/12] fix oops in __audit_signal_info() Greg KH
2007-08-14 7:28 ` [patch 02/12] random: fix bound check ordering (CVE-2007-3105) Greg KH
2007-08-14 7:28 ` [patch 03/12] softmac: Fix deadlock of wx_set_essid with assoc work Greg KH
2007-08-14 7:28 ` Greg KH
2007-08-14 7:29 ` [patch 04/12] ata_piix: update map 10b for ich8m Greg KH
2007-08-14 7:29 ` [patch 05/12] PPC: Revert "Dont complain if size-cells == 0 in prom_parse()" Greg KH
2007-08-14 7:29 ` [patch 07/12] powerpc: Fix size check for hugetlbfs Greg KH
2007-08-14 7:29 ` Greg KH
2007-08-14 7:56 ` David Gibson
2007-08-14 7:56 ` David Gibson
2007-08-14 7:29 ` [patch 06/12] PPC: Revert "Add mdio to bus scan id list for platforms with QE UEC" Greg KH
2007-08-14 7:29 ` [patch 08/12] direct-io: fix error-path crashes Greg KH
2007-08-14 7:29 ` [patch 12/12] CPUFREQ: ondemand: add a check to avoid negative load calculation Greg KH
2007-08-14 7:29 ` Greg KH [this message]
2007-08-14 7:29 ` [patch 10/12] pata_atiixp: add SB700 PCI ID Greg KH
2007-08-14 7:29 ` [patch 09/12] stifb: detect cards in double buffer mode more reliably Greg KH
2007-08-14 16:13 ` [patch 00/12] 2.6.22-stable review Prakash Punnoor
2007-08-14 16:04 ` Greg KH
2007-08-14 17:02 ` Prakash Punnoor
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=20070814072940.GK15025@kroah.com \
--to=gregkh@suse.de \
--cc=akpm@linux-foundation.org \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=cavokz@gmail.com \
--cc=cebbert@redhat.com \
--cc=chuckw@quantumlinux.com \
--cc=davej@redhat.com \
--cc=jmforbes@linuxtx.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mkrufky@linuxtv.org \
--cc=rdunlap@xenotime.net \
--cc=reviews@ml.cw.f00f.org \
--cc=stable@kernel.org \
--cc=torvalds@linux-foundation.org \
--cc=tytso@mit.edu \
--cc=venkatesh.pallipadi@intel.com \
--cc=zwane@arm.linux.org.uk \
/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.