From: "Mark Langsdorf" Subject: [PATCH][cpufreq] Correctly calculate load Date: Mon, 3 Dec 2007 10:50:36 -0600 Message-ID: <200712031050.37094.mark.langsdorf@amd.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org The idle time of the system should be less than the wall time of the system. The initial implementation incorrectly set idle time to wall time when idle time was less than wall time, instead of when idle time was more than wall time. Correct this error. Signed-off-by: Mark Langsdorf diff -r fd879c0688bf drivers/cpufreq/cpufreq_ondemand.c --- a/drivers/cpufreq/cpufreq_ondemand.c Fri Nov 23 16:26:56 2007 +0000 +++ b/drivers/cpufreq/cpufreq_ondemand.c Mon Dec 03 10:27:45 2007 -0600 @@ -319,7 +319,7 @@ static int dbs_calc_load(struct cpu_dbs_ tmp_idle_msecs = tmp_idle_nsecs; if (tmp_wall_msecs == 0) tmp_wall_msecs = 1; - if (tmp_idle_msecs < tmp_wall_msecs) + if (tmp_idle_msecs > tmp_wall_msecs) tmp_idle_msecs = tmp_wall_msecs; tmp_load = (100 * (tmp_wall_msecs - tmp_idle_msecs)) /