aboutsummaryrefslogtreecommitdiffstats
path: root/xen/common
diff options
context:
space:
mode:
authorJan Beulich <jbeulich@suse.com>2013-08-23 15:07:00 +0200
committerJan Beulich <jbeulich@suse.com>2013-08-23 15:07:00 +0200
commit30e9a840b822ea57319abc0d136945a150fb915b (patch)
tree4fe7020f252b39514c004dc34e61630845ba4d62 /xen/common
parentb845268509f30a4f4e8e5ca9e7d323f468d21044 (diff)
downloadxen-30e9a840b822ea57319abc0d136945a150fb915b.tar.gz
xen-30e9a840b822ea57319abc0d136945a150fb915b.tar.bz2
xen-30e9a840b822ea57319abc0d136945a150fb915b.zip
domctl: replace cpumask_weight() uses
In one case it could easily be replaced by range checking the result of a subsequent operation, and in general cpumask_next(), not always needing to scan the whole bitmap, is more efficient than the specific uses of cpumask_weight() here. (When running on big systems, operations on CPU masks aren't cheap enough to use them carelessly.) Signed-off-by: Jan Beulich <jbeulich@suse.com> Acked-by: Keir Fraser <keir@xen.org>
Diffstat (limited to 'xen/common')
-rw-r--r--xen/common/domctl.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/xen/common/domctl.c b/xen/common/domctl.c
index c653efb74b..9760d50955 100644
--- a/xen/common/domctl.c
+++ b/xen/common/domctl.c
@@ -230,15 +230,15 @@ static unsigned int default_vcpu0_location(cpumask_t *online)
*/
cpumask_copy(&cpu_exclude_map, per_cpu(cpu_sibling_mask, 0));
cpu = cpumask_first(&cpu_exclude_map);
- if ( cpumask_weight(&cpu_exclude_map) > 1 )
- cpu = cpumask_next(cpu, &cpu_exclude_map);
- ASSERT(cpu < nr_cpu_ids);
+ i = cpumask_next(cpu, &cpu_exclude_map);
+ if ( i < nr_cpu_ids )
+ cpu = i;
for_each_cpu(i, online)
{
if ( cpumask_test_cpu(i, &cpu_exclude_map) )
continue;
if ( (i == cpumask_first(per_cpu(cpu_sibling_mask, i))) &&
- (cpumask_weight(per_cpu(cpu_sibling_mask, i)) > 1) )
+ (cpumask_next(i, per_cpu(cpu_sibling_mask, i)) < nr_cpu_ids) )
continue;
cpumask_or(&cpu_exclude_map, &cpu_exclude_map,
per_cpu(cpu_sibling_mask, i));