diff options
author | Jan Beulich <jbeulich@suse.com> | 2011-10-21 09:21:09 +0200 |
---|---|---|
committer | Jan Beulich <jbeulich@suse.com> | 2011-10-21 09:21:09 +0200 |
commit | 4f3e36d7ad7cd23f8df44e39fb14313a8a809e3d (patch) | |
tree | 495538ea99a0b2c90eb6f18c87fd48fab2f4ec3e /xen/arch/x86/time.c | |
parent | 3cfbbfcf4cb1d4fecfd1c9a8bab090bdb61e993e (diff) | |
download | xen-4f3e36d7ad7cd23f8df44e39fb14313a8a809e3d.tar.gz xen-4f3e36d7ad7cd23f8df44e39fb14313a8a809e3d.tar.bz2 xen-4f3e36d7ad7cd23f8df44e39fb14313a8a809e3d.zip |
eliminate direct assignments of CPU masks
Use cpumask_copy() instead of direct variable assignments for copying
CPU masks. While direct assignments are not a problem when both sides
are variables actually defined as cpumask_t (except for possibly
copying *much* more than would actually need to be copied), they must
not happen when the original variable is of type cpumask_var_t (which
may have lass space allocated to it than a full cpumask_t). Eliminate
as many of such assignments as possible (in several cases it's even
possible to collapse two operations [copy then clear one bit] into one
[cpumask_andnot()]), and thus set the way for reducing the allocation
size in alloc_cpumask_var().
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
Diffstat (limited to 'xen/arch/x86/time.c')
-rw-r--r-- | xen/arch/x86/time.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/xen/arch/x86/time.c b/xen/arch/x86/time.c index 69b31193fe..e47e1b281d 100644 --- a/xen/arch/x86/time.c +++ b/xen/arch/x86/time.c @@ -1232,10 +1232,10 @@ static void tsc_check_slave(void *unused) { unsigned int cpu = smp_processor_id(); local_irq_disable(); - while ( !cpu_isset(cpu, tsc_check_cpumask) ) + while ( !cpumask_test_cpu(cpu, &tsc_check_cpumask) ) mb(); check_tsc_warp(cpu_khz, &tsc_max_warp); - cpu_clear(cpu, tsc_check_cpumask); + cpumask_clear_cpu(cpu, &tsc_check_cpumask); local_irq_enable(); } @@ -1248,12 +1248,11 @@ static void tsc_check_reliability(void) tsc_check_count++; smp_call_function(tsc_check_slave, NULL, 0); - tsc_check_cpumask = cpu_online_map; + cpumask_andnot(&tsc_check_cpumask, &cpu_online_map, cpumask_of(cpu)); local_irq_disable(); check_tsc_warp(cpu_khz, &tsc_max_warp); - cpu_clear(cpu, tsc_check_cpumask); local_irq_enable(); - while ( !cpus_empty(tsc_check_cpumask) ) + while ( !cpumask_empty(&tsc_check_cpumask) ) cpu_relax(); spin_unlock(&lock); @@ -1280,7 +1279,7 @@ static void time_calibration_tsc_rendezvous(void *_r) int i; struct cpu_calibration *c = &this_cpu(cpu_calibration); struct calibration_rendezvous *r = _r; - unsigned int total_cpus = cpus_weight(r->cpu_calibration_map); + unsigned int total_cpus = cpumask_weight(&r->cpu_calibration_map); /* Loop to get rid of cache effects on TSC skew. */ for ( i = 4; i >= 0; i-- ) @@ -1331,7 +1330,7 @@ static void time_calibration_std_rendezvous(void *_r) { struct cpu_calibration *c = &this_cpu(cpu_calibration); struct calibration_rendezvous *r = _r; - unsigned int total_cpus = cpus_weight(r->cpu_calibration_map); + unsigned int total_cpus = cpumask_weight(&r->cpu_calibration_map); if ( smp_processor_id() == 0 ) { @@ -1362,10 +1361,11 @@ static void (*time_calibration_rendezvous_fn)(void *) = static void time_calibration(void *unused) { struct calibration_rendezvous r = { - .cpu_calibration_map = cpu_online_map, .semaphore = ATOMIC_INIT(0) }; + cpumask_copy(&r.cpu_calibration_map, &cpu_online_map); + /* @wait=1 because we must wait for all cpus before freeing @r. */ on_selected_cpus(&r.cpu_calibration_map, time_calibration_rendezvous_fn, |