[PATCH v2 0/2] x86/topology: add bitmap_weight_from() and use it in topo_unit_count()

Yury Norov (NVIDIA) posted 2 patches 1 month, 2 weeks ago
arch/x86/kernel/cpu/topology.c |  8 ++------
include/linux/bitmap.h         | 30 ++++++++++++++++++++++++++++++
lib/test_bitmap.c              | 26 ++++++++++++++++++++++++++
3 files changed, 58 insertions(+), 6 deletions(-)
[PATCH v2 0/2] x86/topology: add bitmap_weight_from() and use it in topo_unit_count()
Posted by Yury Norov (NVIDIA) 1 month, 2 weeks ago
Currently the function open-codes the missing bitmap_weight_from() with
a for-loop, which is known to be less effective. Add the helper and
switch topo_unit_count() to using it.

v1: https://lore.kernel.org/all/20251214235437.244125-1-yury.norov@gmail.com/
v2:
 - rename 'nbits' to 'end' (Ingo);
 - leverage bitmap_weight() in inline implementation;
 - drop outline implementation;
 - don't handle 'start >= end' case explititly, leave it to user.

Yury Norov (NVIDIA) (2):
  bitmap: add bitmap_weight_from()
  x86/topology: use bitmap_weight_from()

 arch/x86/kernel/cpu/topology.c |  8 ++------
 include/linux/bitmap.h         | 30 ++++++++++++++++++++++++++++++
 lib/test_bitmap.c              | 26 ++++++++++++++++++++++++++
 3 files changed, 58 insertions(+), 6 deletions(-)

-- 
2.43.0