WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [linux-2.6.18-xen] cpufreq: Fix the ondemand driver for

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [linux-2.6.18-xen] cpufreq: Fix the ondemand driver for Xen. No 64-bit division allowed
From: "Xen patchbot-linux-2.6.18-xen" <patchbot-linux-2.6.18-xen@xxxxxxxxxxxxxxxxxxx>
Date: Wed, 14 Nov 2007 04:40:19 -0800
Delivery-date: Wed, 14 Nov 2007 04:41:28 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Keir Fraser <keir@xxxxxxxxxxxxx>
# Date 1194689908 0
# Node ID fced90d566f1158ba1c8593554571f77e25f7118
# Parent  cf8b6cafa2f0a8ba698322786cc78ae28a1b0f60
cpufreq: Fix the ondemand driver for Xen. No 64-bit division allowed
in a 32-bit kernel except in special circumstances.
Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>
---
 drivers/cpufreq/cpufreq_ondemand.c |   16 +++++++++++++---
 1 files changed, 13 insertions(+), 3 deletions(-)

diff -r cf8b6cafa2f0 -r fced90d566f1 drivers/cpufreq/cpufreq_ondemand.c
--- a/drivers/cpufreq/cpufreq_ondemand.c        Thu Nov 08 18:26:08 2007 +0000
+++ b/drivers/cpufreq/cpufreq_ondemand.c        Sat Nov 10 10:18:28 2007 +0000
@@ -296,7 +296,7 @@ static int dbs_calc_load(struct cpu_dbs_
                cputime64_t total_idle_nsecs, tmp_idle_nsecs;
                cputime64_t total_wall_nsecs, tmp_wall_nsecs;
                struct cpu_dbs_info_s *j_dbs_info;
-               unsigned long tmp_load;
+               unsigned long tmp_load, tmp_wall_msecs, tmp_idle_msecs;
 
                j_dbs_info = &per_cpu(cpu_dbs_info, j);
                total_idle_nsecs = idletime[j];
@@ -312,8 +312,18 @@ static int dbs_calc_load(struct cpu_dbs_
                j_dbs_info->prev_cpu_wall = total_wall_nsecs;
                j_dbs_info->prev_cpu_idle = total_idle_nsecs;
 
-               tmp_load = (100 * (tmp_wall_nsecs - tmp_idle_nsecs)) /
-                               tmp_wall_nsecs;
+               /* Convert nsecs to msecs and clamp times to sane values. */
+               do_div(tmp_wall_nsecs, 1000000);
+               tmp_wall_msecs = tmp_wall_nsecs;
+               do_div(tmp_idle_nsecs, 1000000);
+               tmp_idle_msecs = tmp_idle_nsecs;
+               if (tmp_wall_msecs == 0)
+                       tmp_wall_msecs = 1;
+               if (tmp_idle_msecs < tmp_wall_msecs)
+                       tmp_idle_msecs = tmp_wall_msecs;
+
+               tmp_load = (100 * (tmp_wall_msecs - tmp_idle_msecs)) /
+                               tmp_wall_msecs;
                load = max(load, min(100, (int) tmp_load));
        }
        return load;

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [linux-2.6.18-xen] cpufreq: Fix the ondemand driver for Xen. No 64-bit division allowed, Xen patchbot-linux-2.6.18-xen <=