Thread (24 messages) 24 messages, 4 authors, 2021-12-21

Re: [PATCH 08/17] all: replace bitmap_weight with bitmap_weight_{eq,gt,ge,lt,le} where appropriate

From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Date: 2021-12-20 16:41:10
Also in: kvm, linux-alpha, linux-crypto, linux-mips, linux-mm, linux-perf-users, linux-riscv, linux-s390, lkml

On Sat, Dec 18, 2021 at 01:20:04PM -0800, Yury Norov wrote:
Kernel code calls bitmap_weight() to compare the weight of bitmap with
a given number. We can do it more efficiently with bitmap_weight_{eq, ...}
because conditional bitmap_weight may stop traversing the bitmap earlier,
as soon as condition is met.

This patch replaces bitmap_weight with conditional versions where possible,
except for small bitmaps which size is not configurable and  known at
constant time. In that case conditional version of bitmap_weight would not
benefit due to small_const_nbits() optimization; but readability may
suffer.

Signed-off-by: Yury Norov <yury.norov@gmail.com>
---
 arch/x86/kernel/cpu/resctrl/rdtgroup.c                 |  2 +-
 drivers/iio/dummy/iio_simple_dummy_buffer.c            |  4 ++--
 drivers/iio/industrialio-trigger.c                     |  2 +-
 drivers/memstick/core/ms_block.c                       |  4 ++--
 drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c         |  2 +-
 .../net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c  |  2 +-
 .../net/ethernet/marvell/octeontx2/nic/otx2_flows.c    |  4 ++--
 drivers/net/ethernet/mellanox/mlx4/cmd.c               | 10 +++-------
 drivers/net/ethernet/mellanox/mlx4/eq.c                |  4 ++--
 drivers/net/ethernet/mellanox/mlx4/fw.c                |  4 ++--
 drivers/net/ethernet/mellanox/mlx4/main.c              |  2 +-
 drivers/perf/thunderx2_pmu.c                           |  4 ++--
 drivers/staging/media/tegra-video/vi.c                 |  2 +-
 13 files changed, 21 insertions(+), 25 deletions(-)
"all" is not how to submit changes to the kernel.  Please break them up
into subsystem-specific patches, and send them after your core changes
are accepted.

good luck!

greg k-h
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help