ia64/xen-unstable

changeset 2633:44ab932026a6

bitkeeper revision 1.1159.1.227 (416ca176osUUBQBGiZS4hIALhIyUsg)

Slightly smarter initial CPU placement.
author iap10@labyrinth.cl.cam.ac.uk
date Wed Oct 13 03:31:02 2004 +0000 (2004-10-13)
parents 31706ae3b457
children 7565994e86cb
files xen/common/dom0_ops.c
line diff
     1.1 --- a/xen/common/dom0_ops.c	Wed Oct 13 00:22:54 2004 +0000
     1.2 +++ b/xen/common/dom0_ops.c	Wed Oct 13 03:31:02 2004 +0000
     1.3 @@ -178,7 +178,29 @@ long do_dom0_op(dom0_op_t *u_dom0_op)
     1.4              break;
     1.5  
     1.6          if ( op->u.createdomain.cpu == -1 )
     1.7 -            pro = (unsigned int)dom % smp_num_cpus;
     1.8 +	{
     1.9 +	    /* Do an initial placement. Fix me for hyperthreading! */
    1.10 +	    struct domain    *d;
    1.11 +	    int i, j=0, c[smp_num_cpus];
    1.12 +	    
    1.13 +	    pro=0; /* keep compiler happy */
    1.14 +
    1.15 +	    for (i=0;i<smp_num_cpus;i++) 
    1.16 +		c[i]=0;
    1.17 +
    1.18 +	    for_each_domain ( d ) {
    1.19 +		c[d->processor]++;
    1.20 +		j++;
    1.21 +	    }
    1.22 +
    1.23 +	    for (i=0;i<smp_num_cpus;i++) {
    1.24 +		if( c[i]<j )
    1.25 +		{
    1.26 +		    j = c[i];
    1.27 +		    pro = i;
    1.28 +		}
    1.29 +	    }
    1.30 +	}
    1.31          else
    1.32              pro = op->u.createdomain.cpu % smp_num_cpus;
    1.33