[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen master] domctl: replace cpumask_weight() uses



commit 30e9a840b822ea57319abc0d136945a150fb915b
Author:     Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Fri Aug 23 15:07:00 2013 +0200
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Fri Aug 23 15:07:00 2013 +0200

    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>
    Acked-by: Keir Fraser <keir@xxxxxxx>
---
 xen/common/domctl.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/xen/common/domctl.c b/xen/common/domctl.c
index c653efb..9760d50 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));
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.