public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Simon Horman <horms@kernel.org>
To: ynorov@nvidia.com
Cc: Simon Horman <horms@kernel.org>,
	intel-wired-lan@lists.osuosl.org, edumazet@google.com,
	pabeni@redhat.com, anthony.l.nguyen@intel.com,
	akpm@linux-foundation.org, przemyslaw.kitszel@intel.com,
	andrew+netdev@lunn.ch, david.laight.linux@gmail.com,
	yury.norov@gmail.com, linux@rasmusvillemoes.dk,
	netdev@vger.kernel.org, davem@davemloft.net,
	linux-kernel@vger.kernel.org, kuba@kernel.org
Subject: Re: [RESEND,1/3] bitmap: introduce bitmap_weighted_xor()
Date: Sun,  1 Mar 2026 15:19:11 +0000	[thread overview]
Message-ID: <20260301151911.461034-1-horms@kernel.org> (raw)
In-Reply-To: <20260225000007.255837-2-ynorov@nvidia.com>

This is an AI-generated review of your patch. The human sending this
email has considered the AI review valid, or at least plausible.

For local reproduction steps see https://netdev-ai.bots.linux.dev/ai-local.html
---
bitmap: introduce bitmap_weighted_xor()

The function helps to XOR bitmaps and calculate Hamming weight of
the result in one pass.

> diff --git a/include/linux/bitmap.h b/include/linux/bitmap.h
> index b0395e4ccf90..5485076bb2d0 100644
> --- a/include/linux/bitmap.h
> +++ b/include/linux/bitmap.h

[ ... ]

> @@ -352,6 +354,18 @@ unsigned int bitmap_weighted_or(unsigned long *dst, const unsigned long *src1,
>  	}
>  }
>
> +static __always_inline
> +unsigned int bitmap_weighted_xor(unsigned long *dst, const unsigned long *src1,
> +				const unsigned long *src2, unsigned int nbits)
> +{
> +	if (small_const_nbits(nbits)) {
> +		*dst = *src1 ^ *src2;
> +		return hweight_long(*dst & BITMAP_LAST_WORD_MASK(nbits));
> +	} else {
> +		return __bitmap_weighted_xor(dst, src1, src2, nbits);
> +	}
> +}

Should bitmap_weighted_xor() be added to the API documentation block near
the beginning of this header file? The documentation lists bitmap_weighted_or()
at line 48 and bitmap_xor() at line 49. For consistency with the existing
pattern, bitmap_weighted_xor() could be documented similarly to:
"bitmap_weighted_xor(dst, src1, src2, nbits)  *dst = *src1 ^ *src2.
Returns Hamming Weight of dst".

[ ... ]

  reply	other threads:[~2026-03-01 15:19 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-25  0:00 [PATCH RESEND 0/3] ice: use better bitmap API Yury Norov
2026-02-25  0:00 ` [PATCH RESEND 1/3] bitmap: introduce bitmap_weighted_xor() Yury Norov
2026-03-01 15:19   ` Simon Horman [this message]
2026-02-25  0:00 ` [PATCH RESEND 2/3] ice: use bitmap_weighted_xor() in ice_find_free_recp_res_idx() Yury Norov
2026-02-25  0:00 ` [PATCH RESEND 3/3] ice: use bitmap_empty() in ice_vf_has_no_qs_ena Yury Norov
2026-02-25 12:02 ` [PATCH RESEND 0/3] ice: use better bitmap API Przemek Kitszel
2026-02-25 15:41   ` Yury Norov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260301151911.461034-1-horms@kernel.org \
    --to=horms@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=anthony.l.nguyen@intel.com \
    --cc=davem@davemloft.net \
    --cc=david.laight.linux@gmail.com \
    --cc=edumazet@google.com \
    --cc=intel-wired-lan@lists.osuosl.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@rasmusvillemoes.dk \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=przemyslaw.kitszel@intel.com \
    --cc=ynorov@nvidia.com \
    --cc=yury.norov@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox