ia64/xen-unstable
changeset 4407:ac9c554c75d1
bitkeeper revision 1.1159.278.1 (424c69fdsFkm7FZ7SYMwK1Y6v6p1Og)
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@xensource.com
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@xensource.com
author | iap10@freefall.cl.cam.ac.uk |
---|---|
date | Thu Mar 31 21:22:05 2005 +0000 (2005-03-31) |
parents | 1c0462767898 |
children | fead3d49dca1 |
files | xen/common/dom0_ops.c |
line diff
1.1 --- a/xen/common/dom0_ops.c Thu Mar 31 09:55:59 2005 +0000 1.2 +++ b/xen/common/dom0_ops.c Thu Mar 31 21:22:05 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;