public inbox for drm-ai-reviews@public-inbox.freedesktop.org
 help / color / mirror / Atom feed
From: "Loktionov, Aleksandr" <aleksandr.loktionov@intel.com>
To: Yury Norov <ynorov@nvidia.com>,
	"Nguyen, Anthony L" <anthony.l.nguyen@intel.com>,
	"David S. Miller" <davem@davemloft.net>,
	Thomas Hellström <thomas.hellstrom@linux.intel.com>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	Andrew Morton <akpm@linux-foundation.org>,
	David Airlie <airlied@gmail.com>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>,
	"Brost, Matthew" <matthew.brost@intel.com>,
	Paolo Abeni <pabeni@redhat.com>,
	"Kitszel, Przemyslaw" <przemyslaw.kitszel@intel.com>,
	"Vivi, Rodrigo" <rodrigo.vivi@intel.com>,
	Simona Vetter <simona@ffwll.ch>,
	Yury Norov <yury.norov@gmail.com>,
	Rasmus Villemoes <linux@rasmusvillemoes.dk>,
	"dri-devel@lists.freedesktop.org"
	<dri-devel@lists.freedesktop.org>,
	"intel-xe@lists.freedesktop.org" <intel-xe@lists.freedesktop.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"intel-wired-lan@lists.osuosl.org"
	<intel-wired-lan@lists.osuosl.org>
Cc: Simon Horman <horms@kernel.org>,
	David Laight <david.laight.linux@gmail.com>
Subject: RE: [Intel-wired-lan] [PATCH v2 1/4] bitmap: introduce bitmap_weighted_xor()
Date: Mon, 2 Mar 2026 07:12:57 +0000	[thread overview]
Message-ID: <IA3PR11MB89860CAC89B9A811650A0F16E57EA@IA3PR11MB8986.namprd11.prod.outlook.com> (raw)
In-Reply-To: <20260302011159.61778-2-ynorov@nvidia.com>



> -----Original Message-----
> From: Intel-wired-lan <intel-wired-lan-bounces@osuosl.org> On Behalf
> Of Yury Norov via Intel-wired-lan
> Sent: Monday, March 2, 2026 2:12 AM
> To: Nguyen, Anthony L <anthony.l.nguyen@intel.com>; David S. Miller
> <davem@davemloft.net>; Thomas Hellström
> <thomas.hellstrom@linux.intel.com>; Andrew Lunn
> <andrew+netdev@lunn.ch>; Andrew Morton <akpm@linux-foundation.org>;
> David Airlie <airlied@gmail.com>; Eric Dumazet <edumazet@google.com>;
> Jakub Kicinski <kuba@kernel.org>; Brost, Matthew
> <matthew.brost@intel.com>; Paolo Abeni <pabeni@redhat.com>; Kitszel,
> Przemyslaw <przemyslaw.kitszel@intel.com>; Vivi, Rodrigo
> <rodrigo.vivi@intel.com>; Simona Vetter <simona@ffwll.ch>; Yury Norov
> <yury.norov@gmail.com>; Rasmus Villemoes <linux@rasmusvillemoes.dk>;
> dri-devel@lists.freedesktop.org; intel-xe@lists.freedesktop.org;
> linux-kernel@vger.kernel.org; netdev@vger.kernel.org; intel-wired-
> lan@lists.osuosl.org
> Cc: Yury Norov <ynorov@nvidia.com>; Simon Horman <horms@kernel.org>;
> David Laight <david.laight.linux@gmail.com>
> Subject: [Intel-wired-lan] [PATCH v2 1/4] bitmap: introduce
> bitmap_weighted_xor()
> 
> The function helps to XOR bitmaps and calculate Hamming weight of the
> result in one pass.
> 
> Signed-off-by: Yury Norov <ynorov@nvidia.com>
> ---
>  include/linux/bitmap.h | 15 +++++++++++++++
>  lib/bitmap.c           |  7 +++++++
>  2 files changed, 22 insertions(+)
> 
> diff --git a/include/linux/bitmap.h b/include/linux/bitmap.h index
> b0395e4ccf90..874f744870ef 100644
> --- a/include/linux/bitmap.h
> +++ b/include/linux/bitmap.h
> @@ -46,6 +46,7 @@ struct device;
>   *  bitmap_and(dst, src1, src2, nbits)          *dst = *src1 & *src2
>   *  bitmap_or(dst, src1, src2, nbits)           *dst = *src1 | *src2
>   *  bitmap_weighted_or(dst, src1, src2, nbits)	*dst = *src1 | *src2.
> Returns Hamming Weight of dst
> + *  bitmap_weighted_xor(dst, src1, src2, nbits)	*dst = *src1 ^
> *src2. Returns Hamming Weight of dst
>   *  bitmap_xor(dst, src1, src2, nbits)          *dst = *src1 ^ *src2
>   *  bitmap_andnot(dst, src1, src2, nbits)       *dst = *src1 &
> ~(*src2)
>   *  bitmap_complement(dst, src, nbits)          *dst = ~(*src)
> @@ -168,6 +169,8 @@ void __bitmap_or(unsigned long *dst, const
> unsigned long *bitmap1,
>  		 const unsigned long *bitmap2, unsigned int nbits);
> unsigned int __bitmap_weighted_or(unsigned long *dst, const unsigned
> long *bitmap1,
>  				  const unsigned long *bitmap2, unsigned
> int nbits);
> +unsigned int __bitmap_weighted_xor(unsigned long *dst, const unsigned
> long *bitmap1,
> +				  const unsigned long *bitmap2, unsigned
> int nbits);
>  void __bitmap_xor(unsigned long *dst, const unsigned long *bitmap1,
>  		  const unsigned long *bitmap2, unsigned int nbits);
> bool __bitmap_andnot(unsigned long *dst, const unsigned long *bitmap1,
> @@ -352,6 +355,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);
> +	}
> +}
> +
>  static __always_inline
>  void bitmap_xor(unsigned long *dst, const unsigned long *src1,
>  		const unsigned long *src2, unsigned int nbits) diff --
> git a/lib/bitmap.c b/lib/bitmap.c index 9dc526507875..a2bcb5b1fe99
> 100644
> --- a/lib/bitmap.c
> +++ b/lib/bitmap.c
> @@ -361,6 +361,13 @@ unsigned int __bitmap_weighted_or(unsigned long
> *dst, const unsigned long *bitma
>  	return BITMAP_WEIGHT(({dst[idx] = bitmap1[idx] | bitmap2[idx];
> dst[idx]; }), bits);  }
> 
> +unsigned int __bitmap_weighted_xor(unsigned long *dst, const unsigned
> long *bitmap1,
> +				  const unsigned long *bitmap2, unsigned
> int bits) {
> +	return BITMAP_WEIGHT(({dst[idx] = bitmap1[idx] ^ bitmap2[idx];
> +dst[idx]; }), bits); } EXPORT_SYMBOL(__bitmap_weighted_xor);
> +
>  void __bitmap_set(unsigned long *map, unsigned int start, int len)  {
>  	unsigned long *p = map + BIT_WORD(start);
> --
> 2.43.0

Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>

  reply	other threads:[~2026-03-02  7:13 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-02  1:11 [PATCH v2 0/4] ice: use better bitmap API Yury Norov
2026-03-02  1:11 ` [PATCH v2 1/4] bitmap: introduce bitmap_weighted_xor() Yury Norov
2026-03-02  7:12   ` Loktionov, Aleksandr [this message]
2026-03-02  1:11 ` [PATCH v2 2/4] ice: use bitmap_weighted_xor() in ice_find_free_recp_res_idx() Yury Norov
2026-03-02  7:13   ` [Intel-wired-lan] " Loktionov, Aleksandr
2026-03-02  1:11 ` [PATCH v2 3/4] ice: use bitmap_empty() in ice_vf_has_no_qs_ena Yury Norov
2026-03-02  7:14   ` [Intel-wired-lan] " Loktionov, Aleksandr
2026-03-02  1:11 ` [PATCH v2 4/4] drm/xe: switch xe_pagefault_queue_init() to using bitmap_weighted_or() Yury Norov
2026-03-02  7:14   ` [Intel-wired-lan] " Loktionov, Aleksandr
2026-03-02 19:49   ` Matthew Brost
2026-03-02 23:01 ` [PATCH v2 0/4] ice: use better bitmap API Jacob Keller
2026-03-03  3:47 ` Claude review: " Claude Code Review Bot

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=IA3PR11MB89860CAC89B9A811650A0F16E57EA@IA3PR11MB8986.namprd11.prod.outlook.com \
    --to=aleksandr.loktionov@intel.com \
    --cc=airlied@gmail.com \
    --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=dri-devel@lists.freedesktop.org \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=intel-wired-lan@lists.osuosl.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@rasmusvillemoes.dk \
    --cc=matthew.brost@intel.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=przemyslaw.kitszel@intel.com \
    --cc=rodrigo.vivi@intel.com \
    --cc=simona@ffwll.ch \
    --cc=thomas.hellstrom@linux.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