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/common/keyhandler.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/common/keyhandler.c')
-rw-r--r-- | xen/common/keyhandler.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/xen/common/keyhandler.c b/xen/common/keyhandler.c index 51cfc3cc98..25c5215023 100644 --- a/xen/common/keyhandler.c +++ b/xen/common/keyhandler.c @@ -93,11 +93,11 @@ void dump_execstate(struct cpu_user_regs *regs) printk("\n"); } - cpu_clear(cpu, dump_execstate_mask); + cpumask_clear_cpu(cpu, &dump_execstate_mask); if ( !alt_key_handling ) return; - cpu = cycle_cpu(cpu, dump_execstate_mask); + cpu = cpumask_cycle(cpu, &dump_execstate_mask); if ( cpu < nr_cpu_ids ) { smp_send_state_dump(cpu); @@ -118,7 +118,7 @@ static void dump_registers(unsigned char key, struct cpu_user_regs *regs) printk("'%c' pressed -> dumping registers\n\n", key); - dump_execstate_mask = cpu_online_map; + cpumask_copy(&dump_execstate_mask, &cpu_online_map); /* Get local execution state out immediately, in case we get stuck. */ dump_execstate(regs); @@ -131,7 +131,7 @@ static void dump_registers(unsigned char key, struct cpu_user_regs *regs) for_each_cpu_mask ( cpu, dump_execstate_mask ) { smp_send_state_dump(cpu); - while ( cpu_isset(cpu, dump_execstate_mask) ) + while ( cpumask_test_cpu(cpu, &dump_execstate_mask) ) cpu_relax(); } @@ -324,11 +324,11 @@ static void read_clocks_slave(void *unused) { unsigned int cpu = smp_processor_id(); local_irq_disable(); - while ( !cpu_isset(cpu, read_clocks_cpumask) ) + while ( !cpumask_test_cpu(cpu, &read_clocks_cpumask) ) cpu_relax(); per_cpu(read_clocks_time, cpu) = NOW(); per_cpu(read_cycles_time, cpu) = get_cycles(); - cpu_clear(cpu, read_clocks_cpumask); + cpumask_clear_cpu(cpu, &read_clocks_cpumask); local_irq_enable(); } @@ -348,13 +348,12 @@ static void read_clocks(unsigned char key) smp_call_function(read_clocks_slave, NULL, 0); local_irq_disable(); - read_clocks_cpumask = cpu_online_map; + cpumask_andnot(&read_clocks_cpumask, &cpu_online_map, cpumask_of(cpu)); per_cpu(read_clocks_time, cpu) = NOW(); per_cpu(read_cycles_time, cpu) = get_cycles(); - cpu_clear(cpu, read_clocks_cpumask); local_irq_enable(); - while ( !cpus_empty(read_clocks_cpumask) ) + while ( !cpumask_empty(&read_clocks_cpumask) ) cpu_relax(); min_stime_cpu = max_stime_cpu = min_cycles_cpu = max_cycles_cpu = cpu; |