[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH 5/5] 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@xxxxxxxx> --- a/xen/common/domctl.c +++ b/xen/common/domctl.c @@ -230,15 +230,15 @@ static unsigned int default_vcpu0_locati */ 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)); Attachment:
domctl-replace-cpumask_weight.patch _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |