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] Make default CPU placement of domains a bit smarter on s

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] Make default CPU placement of domains a bit smarter on systems with
From: BitKeeper Bot <riel@xxxxxxxxxxx>
Date: Thu, 31 Mar 2005 21:22:05 +0000
Delivery-date: Thu, 31 Mar 2005 22:02:55 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
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 Development List <xen-devel@xxxxxxxxxxxxxxxxxxxxx>
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
ChangeSet 1.1159.276.1, 2005/03/31 22:22:05+01:00, iap10@xxxxxxxxxxxxxxxxxxxxx

        Make default CPU placement of domains a bit smarter on systems with
        hyperthreading: only dom0 gets to use hyperthreading by default, we
        effectively ignore it on all other CPUs by allocating domains to
        the same hyperthread. If you don't like this, use 'xm pincpu' to
        change it. [note: we probably need to make pincpu more expressive,
        providing a list of CPUs that the domain can be scheduled on.]
        
        Signed-off-by: ian@xxxxxxxxxxxxx



 dom0_ops.c |   16 +++++++++++-----
 1 files changed, 11 insertions(+), 5 deletions(-)


diff -Nru a/xen/common/dom0_ops.c b/xen/common/dom0_ops.c
--- a/xen/common/dom0_ops.c     2005-03-31 17:02:52 -05:00
+++ b/xen/common/dom0_ops.c     2005-03-31 17:02:52 -05:00
@@ -161,7 +161,7 @@
     case DOM0_CREATEDOMAIN:
     {
         struct domain *d;
-        unsigned int   pro = 0;
+        unsigned int   pro;
         domid_t        dom;
 
         dom = op->u.createdomain.domain;
@@ -178,16 +178,22 @@
         {
             /* Do an initial placement. Pick the least-populated CPU. */
             struct domain *d;
-            unsigned int i, cnt[NR_CPUS] = { 0 };
+            unsigned int i, ht, cnt[NR_CPUS] = { 0 };
 
             read_lock(&domlist_lock);
             for_each_domain ( d )
                 cnt[d->processor]++;
             read_unlock(&domlist_lock);
 
-            for ( i = 0; i < smp_num_cpus; i++ )
-                if ( cnt[i] < cnt[pro] )
-                    pro = i;
+            /* If we're on a HT system, we only use the first HT for dom0,
+               other domains will all share the second HT of each CPU.
+              Since dom0 is on CPU 0, we favour high numbered CPUs in
+              the event of a tie */
+            ht = opt_noht ? 1 : ht_per_core;
+            pro = ht-1;
+            for ( i = pro; i < smp_num_cpus; i += ht )
+               if ( cnt[i] <= cnt[pro] )
+                   pro = i;
         }
         else
             pro = op->u.createdomain.cpu % smp_num_cpus;

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

<Prev in Thread] Current Thread [Next in Thread>