diff options
author | Keir Fraser <keir.fraser@citrix.com> | 2010-05-14 20:37:02 +0100 |
---|---|---|
committer | Keir Fraser <keir.fraser@citrix.com> | 2010-05-14 20:37:02 +0100 |
commit | 7f01473211b2586130c653d3b1ac15acc082d4df (patch) | |
tree | 48cda4464ba8a8ff424e5c3d7dd9d0aa3a9fa9c3 /xen/common/sched_sedf.c | |
parent | f9ffb1134c8be2f6bffd14578c179d3f12371abd (diff) | |
download | xen-7f01473211b2586130c653d3b1ac15acc082d4df.tar.gz xen-7f01473211b2586130c653d3b1ac15acc082d4df.tar.bz2 xen-7f01473211b2586130c653d3b1ac15acc082d4df.zip |
Remove many uses of cpu_possible_map and iterators over NR_CPUS.
The significant remaining culprits for x86 are credit2, hpet, and
percpu-area subsystems. To be dealt with in a separate patch.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
Diffstat (limited to 'xen/common/sched_sedf.c')
-rw-r--r-- | xen/common/sched_sedf.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/xen/common/sched_sedf.c b/xen/common/sched_sedf.c index 6223fc030d..a9d107b546 100644 --- a/xen/common/sched_sedf.c +++ b/xen/common/sched_sedf.c @@ -1333,7 +1333,7 @@ static int sedf_adjust_weights(struct cpupool *c, struct xen_domctl_scheduler_op { struct vcpu *p; struct domain *d; - unsigned int nr_cpus = last_cpu(cpu_possible_map) + 1; + unsigned int cpu, nr_cpus = last_cpu(cpu_online_map) + 1; int *sumw = xmalloc_array(int, nr_cpus); s_time_t *sumt = xmalloc_array(s_time_t, nr_cpus); @@ -1354,9 +1354,12 @@ static int sedf_adjust_weights(struct cpupool *c, struct xen_domctl_scheduler_op continue; for_each_vcpu( d, p ) { + if ( (cpu = p->processor) >= nr_cpus ) + continue; + if ( EDOM_INFO(p)->weight ) { - sumw[p->processor] += EDOM_INFO(p)->weight; + sumw[cpu] += EDOM_INFO(p)->weight; } else { @@ -1367,7 +1370,7 @@ static int sedf_adjust_weights(struct cpupool *c, struct xen_domctl_scheduler_op /*check for overflows*/ ASSERT((WEIGHT_PERIOD < ULONG_MAX) && (EDOM_INFO(p)->slice_orig < ULONG_MAX)); - sumt[p->processor] += + sumt[cpu] += (WEIGHT_PERIOD * EDOM_INFO(p)->slice_orig) / EDOM_INFO(p)->period_orig; } @@ -1381,6 +1384,8 @@ static int sedf_adjust_weights(struct cpupool *c, struct xen_domctl_scheduler_op { for_each_vcpu ( d, p ) { + if ( (cpu = p->processor) >= nr_cpus ) + continue; if ( EDOM_INFO(p)->weight ) { EDOM_INFO(p)->period_orig = @@ -1388,8 +1393,7 @@ static int sedf_adjust_weights(struct cpupool *c, struct xen_domctl_scheduler_op EDOM_INFO(p)->slice_orig = EDOM_INFO(p)->slice = (EDOM_INFO(p)->weight * - (WEIGHT_PERIOD - WEIGHT_SAFETY - sumt[p->processor])) / - sumw[p->processor]; + (WEIGHT_PERIOD - WEIGHT_SAFETY - sumt[cpu])) / sumw[cpu]; } } } |