[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] Small sysctl cleanups.



# HG changeset patch
# User Keir Fraser <keir@xxxxxxxxxxxxx>
# Date 1182976071 -3600
# Node ID b370047d0fa033f7f9d8a91ff101a11b4314e9b7
# Parent  f152e44325a7eab2bf6e0994c4ef5fca12d93d52
Small sysctl cleanups.
Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>
---
 xen/common/schedule.c       |    8 ++------
 xen/common/sysctl.c         |   17 +++++++++--------
 xen/include/public/sysctl.h |    2 +-
 3 files changed, 12 insertions(+), 15 deletions(-)

diff -r f152e44325a7 -r b370047d0fa0 xen/common/schedule.c
--- a/xen/common/schedule.c     Wed Jun 27 21:05:54 2007 +0100
+++ b/xen/common/schedule.c     Wed Jun 27 21:27:51 2007 +0100
@@ -72,12 +72,8 @@ static inline void vcpu_runstate_change(
     ASSERT(v->runstate.state != new_state);
     ASSERT(spin_is_locked(&per_cpu(schedule_data,v->processor).schedule_lock));
 
-    if(unlikely((v->runstate.state_entry_time - new_entry_time) > TIME_SLOP))
-        /* Local time on this CPU has been warped */
-        v->runstate.time[v->runstate.state] = new_entry_time; 
-    else 
-        v->runstate.time[v->runstate.state] +=
-            new_entry_time - v->runstate.state_entry_time;
+    v->runstate.time[v->runstate.state] +=
+        new_entry_time - v->runstate.state_entry_time;
     v->runstate.state_entry_time = new_entry_time;
     v->runstate.state = new_state;
 }
diff -r f152e44325a7 -r b370047d0fa0 xen/common/sysctl.c
--- a/xen/common/sysctl.c       Wed Jun 27 21:05:54 2007 +0100
+++ b/xen/common/sysctl.c       Wed Jun 27 21:27:51 2007 +0100
@@ -140,19 +140,20 @@ long do_sysctl(XEN_GUEST_HANDLE(xen_sysc
     {
         uint32_t i, nr_cpus;
         uint64_t idletime;
+        struct vcpu *v;
 
-        nr_cpus = (op->u.cpuinfo.max_cpus > NR_CPUS) ? NR_CPUS :
-            op->u.cpuinfo.max_cpus;
+        nr_cpus = min_t(uint32_t, op->u.cpuinfo.max_cpus, NR_CPUS);
 
         for ( i = 0; i < nr_cpus; i++ )
         {
-            if(!idle_vcpu[i])
-                /* XXX: assumes no further CPUs after first missing one */
+            /* Assume no holes in idle-vcpu map. */
+            if ( (v = idle_vcpu[i]) == NULL )
                 break;
 
-            /* somewhat imprecise but should suffice */
-            idletime = idle_vcpu[i]->runstate.time[RUNSTATE_running] +
-                (NOW() - idle_vcpu[i]->runstate.state_entry_time);
+            idletime = v->runstate.time[RUNSTATE_running];
+            if ( v->is_running )
+                idletime += NOW() - v->runstate.state_entry_time;
+
             if ( copy_to_guest_offset(op->u.cpuinfo.buffer, i, &idletime, 1) )
             {
                 ret = -EFAULT;
@@ -163,7 +164,7 @@ long do_sysctl(XEN_GUEST_HANDLE(xen_sysc
         op->u.cpuinfo.nr_cpus = i;
         ret = 0;
 
-        if( copy_to_guest (u_sysctl, op, 1) )
+        if ( copy_to_guest(u_sysctl, op, 1) )
             ret = -EFAULT;
     }
     break;
diff -r f152e44325a7 -r b370047d0fa0 xen/include/public/sysctl.h
--- a/xen/include/public/sysctl.h       Wed Jun 27 21:05:54 2007 +0100
+++ b/xen/include/public/sysctl.h       Wed Jun 27 21:27:51 2007 +0100
@@ -158,7 +158,7 @@ struct xen_sysctl_cpuinfo {
     /* IN variables. */
     uint32_t                      max_cpus;
     XEN_GUEST_HANDLE_64(uint64_t) buffer;
-    /* IN/OUT variables. */
+    /* OUT variables. */
     uint32_t                      nr_cpus;
 }; 
 typedef struct xen_sysctl_cpuinfo xen_sysctl_cpuinfo_t;

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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.