ia64/xen-unstable

changeset 4408:fead3d49dca1

bitkeeper revision 1.1159.258.84 (424c6a06y0iRheV72bjPbD5lRslQRQ)

Merge freefall.cl.cam.ac.uk:/auto/groups/xeno-xenod/BK/xen-2.0-testing.bk
into freefall.cl.cam.ac.uk:/auto/groups/xeno/users/iap10/xeno-clone/xen-2.0-testing.bk
author iap10@freefall.cl.cam.ac.uk
date Thu Mar 31 21:22:14 2005 +0000 (2005-03-31)
parents 332cd3fd995c ac9c554c75d1
children e0ebda45aae6 3e78eadd8fb9
files xen/common/dom0_ops.c
line diff
     1.1 --- a/xen/common/dom0_ops.c	Thu Mar 31 15:43:57 2005 +0000
     1.2 +++ b/xen/common/dom0_ops.c	Thu Mar 31 21:22:14 2005 +0000
     1.3 @@ -161,7 +161,7 @@ long do_dom0_op(dom0_op_t *u_dom0_op)
     1.4      case DOM0_CREATEDOMAIN:
     1.5      {
     1.6          struct domain *d;
     1.7 -        unsigned int   pro = 0;
     1.8 +        unsigned int   pro;
     1.9          domid_t        dom;
    1.10  
    1.11          dom = op->u.createdomain.domain;
    1.12 @@ -178,16 +178,22 @@ long do_dom0_op(dom0_op_t *u_dom0_op)
    1.13          {
    1.14              /* Do an initial placement. Pick the least-populated CPU. */
    1.15              struct domain *d;
    1.16 -            unsigned int i, cnt[NR_CPUS] = { 0 };
    1.17 +            unsigned int i, ht, cnt[NR_CPUS] = { 0 };
    1.18  
    1.19              read_lock(&domlist_lock);
    1.20              for_each_domain ( d )
    1.21                  cnt[d->processor]++;
    1.22              read_unlock(&domlist_lock);
    1.23  
    1.24 -            for ( i = 0; i < smp_num_cpus; i++ )
    1.25 -                if ( cnt[i] < cnt[pro] )
    1.26 -                    pro = i;
    1.27 +            /* If we're on a HT system, we only use the first HT for dom0,
    1.28 +               other domains will all share the second HT of each CPU.
    1.29 +	       Since dom0 is on CPU 0, we favour high numbered CPUs in
    1.30 +	       the event of a tie */
    1.31 +            ht = opt_noht ? 1 : ht_per_core;
    1.32 +            pro = ht-1;
    1.33 +            for ( i = pro; i < smp_num_cpus; i += ht )
    1.34 +		if ( cnt[i] <= cnt[pro] )
    1.35 +		    pro = i;
    1.36          }
    1.37          else
    1.38              pro = op->u.createdomain.cpu % smp_num_cpus;