credit1: replace cpumask_empty() uses
authorJan Beulich <jbeulich@suse.com>
Fri, 23 Aug 2013 13:06:21 +0000 (15:06 +0200)
committerJan Beulich <jbeulich@suse.com>
Fri, 23 Aug 2013 13:06:21 +0000 (15:06 +0200)
In one case it was redundant with the operation it got combined with,
and in the other it could easily be replaced by range checking the
result of a subsequent operation. (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>
Reviewed-by: George Dunlap <george.dunlap@eu.citrix.com>
xen/common/sched_credit.c

index 318831054d0ff1f1732ee31667f635d107520b6c..0b816629e6aeced88a7d623cb52d0064f13aba5e 100644 (file)
@@ -641,7 +641,7 @@ _csched_cpu_pick(const struct scheduler *ops, struct vcpu *vc, bool_t commit)
         cpu = cpumask_test_cpu(vc->processor, &cpus)
                 ? vc->processor
                 : cpumask_cycle(vc->processor, &cpus);
-        ASSERT( !cpumask_empty(&cpus) && cpumask_test_cpu(cpu, &cpus) );
+        ASSERT(cpumask_test_cpu(cpu, &cpus));
 
         /*
          * Try to find an idle processor within the above constraints.
@@ -1520,10 +1520,9 @@ csched_load_balance(struct csched_private *prv, int cpu,
             cpumask_and(&workers, &workers, &node_to_cpumask(peer_node));
             cpumask_clear_cpu(cpu, &workers);
 
-            if ( cpumask_empty(&workers) )
-                goto next_node;
-
             peer_cpu = cpumask_first(&workers);
+            if ( peer_cpu >= nr_cpu_ids )
+                goto next_node;
             do
             {
                 /*