]> xenbits.xensource.com Git - xen.git/commit
xen/bitops: Convert 'hweight(x) > 1' to new multiple_bits_set()
authorAndrew Cooper <andrew.cooper3@citrix.com>
Thu, 22 Aug 2024 16:01:53 +0000 (17:01 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Tue, 3 Sep 2024 19:22:18 +0000 (20:22 +0100)
commitd35fb45d3c7b6d80f290ea6feea978d6ac6cca89
tree30178ef649f54f19acfcb7df978402ecb6eabced
parentbd1664db7b7d1646b9dcd01658c8667bf01a68d5
xen/bitops: Convert 'hweight(x) > 1' to new multiple_bits_set()

Using hweight() is an especially expensive way of determining simply if
multiple bits are set in a value.  Worse, 4 of the 10 hweight() calls in Xen
are of this form.

Switch to the new multiple_bits_set() helper.  This is far more efficient than
the longhand hweight() algorithm and, owing to its simplicity, likely more
efficient than even a dedicated instruction on a superscalar processor.

No functional change.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
xen/arch/x86/cpu/vpmu.c
xen/arch/x86/hvm/vlapic.c
xen/common/numa.c