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

Greg Kroah-Hartman gregkh at linuxfoundation.org
Mon Dec 20 08:41:02 PST 2021


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 at 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



More information about the linux-snps-arc mailing list