xen/smp: Speed up on_selected_cpus()
authorAndrew Cooper <andrew.cooper3@citrix.com>
Fri, 4 Feb 2022 20:12:04 +0000 (20:12 +0000)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Mon, 7 Feb 2022 17:41:24 +0000 (17:41 +0000)
commitf97c1abf2934e76fb69fabaf4f5ec04afa813816
tree30ecfcd670129e40159f39dd9e413262a0e817b6
parente9b32164142e40a2585543a46530066b58a76f3f
xen/smp: Speed up on_selected_cpus()

cpumask_weight() is an incredibly expensive way to find if no bits are set,
made worse by the fact that the calculation is performed with the global
call_lock held.

This appears to be a missing optimisation from c/s 433f14699d48 ("x86: Clean
up smp_call_function handling.") in 2011 which dropped the logic requiring the
count of CPUs.

Switch to using cpumask_empty() instead, which will short circuit as soon as
it finds any set bit in the cpumask.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Julien Grall <jgrall@amazon.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
xen/common/smp.c