arch/alpha: replace cpumask_weight with cpumask_empty where appropriate
authorYury Norov <yury.norov@gmail.com>
Sun, 23 Jan 2022 18:38:44 +0000 (10:38 -0800)
committerYury Norov <yury.norov@gmail.com>
Fri, 3 Jun 2022 13:52:57 +0000 (06:52 -0700)
common_shutdown_1() calls cpumask_weight() to check if any bit of a
given cpumask is set. We can do it more efficiently with cpumask_empty()
because cpumask_empty() stops traversing the cpumask as soon as it finds
first set bit, while cpumask_weight() counts all bits unconditionally.

Signed-off-by: Yury Norov <yury.norov@gmail.com>
arch/alpha/kernel/process.c

index 5f8527081da92fc69d12b77be04f706475c21239..0d4bc60828bf638fd64f565adc28eea6516d3513 100644 (file)
@@ -125,7 +125,7 @@ common_shutdown_1(void *generic_ptr)
        /* Wait for the secondaries to halt. */
        set_cpu_present(boot_cpuid, false);
        set_cpu_possible(boot_cpuid, false);
-       while (cpumask_weight(cpu_present_mask))
+       while (!cpumask_empty(cpu_present_mask))
                barrier();
 #endif