<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux.git/lib/bitmap.c, branch v7.1-rc2</title>
<subtitle>Linux kernel source tree</subtitle>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/'/>
<entry>
<title>bitmap: introduce bitmap_weighted_xor()</title>
<updated>2026-04-02T00:03:07+00:00</updated>
<author>
<name>Yury Norov</name>
<email>ynorov@nvidia.com</email>
</author>
<published>2026-03-02T01:11:55+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=d57e74f10461b80c77d1678f646720f616fb8553'/>
<id>d57e74f10461b80c77d1678f646720f616fb8553</id>
<content type='text'>
The function helps to XOR bitmaps and calculate Hamming weight of
the result in one pass.

Reviewed-by: Aleksandr Loktionov &lt;aleksandr.loktionov@intel.com&gt;
Reviewed-by: Jacob Keller &lt;jacob.e.keller@intel.com&gt;
Signed-off-by: Yury Norov &lt;ynorov@nvidia.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The function helps to XOR bitmaps and calculate Hamming weight of
the result in one pass.

Reviewed-by: Aleksandr Loktionov &lt;aleksandr.loktionov@intel.com&gt;
Reviewed-by: Jacob Keller &lt;jacob.e.keller@intel.com&gt;
Signed-off-by: Yury Norov &lt;ynorov@nvidia.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>bitmap: add test_zero_nbits()</title>
<updated>2026-03-24T17:39:53+00:00</updated>
<author>
<name>Yury Norov</name>
<email>ynorov@nvidia.com</email>
</author>
<published>2026-03-19T00:43:48+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=95d324fb1b48434f4c659e4c245c3bdeecdff22c'/>
<id>95d324fb1b48434f4c659e4c245c3bdeecdff22c</id>
<content type='text'>
In most real-life cases, 0-length bitmap provided by user is a sign of
an error. The API doesn't provide any guarantees on returned value, and
the bitmap pointers are not dereferenced.

Signed-off-by: Yury Norov &lt;ynorov@nvidia.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
In most real-life cases, 0-length bitmap provided by user is a sign of
an error. The API doesn't provide any guarantees on returned value, and
the bitmap pointers are not dereferenced.

Signed-off-by: Yury Norov &lt;ynorov@nvidia.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>cpumask: Introduce cpumask_weighted_or()</title>
<updated>2025-11-20T11:14:54+00:00</updated>
<author>
<name>Thomas Gleixner</name>
<email>tglx@linutronix.de</email>
</author>
<published>2025-11-19T17:26:57+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=437cb3ded25038d5280d21de489ce78c745118d5'/>
<id>437cb3ded25038d5280d21de489ce78c745118d5</id>
<content type='text'>
CID management OR's two cpumasks and then calculates the weight on the
result. That's inefficient as that has to walk the same stuff twice. As
this is done with runqueue lock held, there is a real benefit of speeding
this up. Depending on the system this results in 10-20% less cycles spent
with runqueue lock held for a 4K cpumask.

Provide cpumask_weighted_or() and the corresponding bitmap functions which
return the weight of the OR result right away.

Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Signed-off-by: Peter Zijlstra (Intel) &lt;peterz@infradead.org&gt;
Reviewed-by: Yury Norov (NVIDIA) &lt;yury.norov@gmail.com&gt;
Reviewed-by: Mathieu Desnoyers &lt;mathieu.desnoyers@efficios.com&gt;
Link: https://patch.msgid.link/20251119172549.448263340@linutronix.de
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
CID management OR's two cpumasks and then calculates the weight on the
result. That's inefficient as that has to walk the same stuff twice. As
this is done with runqueue lock held, there is a real benefit of speeding
this up. Depending on the system this results in 10-20% less cycles spent
with runqueue lock held for a 4K cpumask.

Provide cpumask_weighted_or() and the corresponding bitmap functions which
return the weight of the OR result right away.

Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Signed-off-by: Peter Zijlstra (Intel) &lt;peterz@infradead.org&gt;
Reviewed-by: Yury Norov (NVIDIA) &lt;yury.norov@gmail.com&gt;
Reviewed-by: Mathieu Desnoyers &lt;mathieu.desnoyers@efficios.com&gt;
Link: https://patch.msgid.link/20251119172549.448263340@linutronix.de
</pre>
</div>
</content>
</entry>
<entry>
<title>cpumask: add cpumask_weight_andnot()</title>
<updated>2024-02-01T12:06:40+00:00</updated>
<author>
<name>Yury Norov</name>
<email>yury.norov@gmail.com</email>
</author>
<published>2024-01-29T06:21:04+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=c1f5204efcbcced83f67f12fa8f1a7f5f244fb87'/>
<id>c1f5204efcbcced83f67f12fa8f1a7f5f244fb87</id>
<content type='text'>
Similarly to cpumask_weight_and(), cpumask_weight_andnot() is a handy
helper that may help to avoid creating an intermediate mask just to
calculate number of bits that set in a 1st given mask, and clear in 2nd
one.

Signed-off-by: Yury Norov &lt;yury.norov@gmail.com&gt;
Reviewed-by: Jacob Keller &lt;jacob.e.keller@intel.com&gt;
Signed-off-by: Paolo Abeni &lt;pabeni@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Similarly to cpumask_weight_and(), cpumask_weight_andnot() is a handy
helper that may help to avoid creating an intermediate mask just to
calculate number of bits that set in a 1st given mask, and clear in 2nd
one.

Signed-off-by: Yury Norov &lt;yury.norov@gmail.com&gt;
Reviewed-by: Jacob Keller &lt;jacob.e.keller@intel.com&gt;
Signed-off-by: Paolo Abeni &lt;pabeni@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>bitmap: move bitmap_*_region() functions to bitmap.h</title>
<updated>2023-10-16T23:14:45+00:00</updated>
<author>
<name>Yury Norov</name>
<email>yury.norov@gmail.com</email>
</author>
<published>2023-09-25T02:38:17+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=6cb42f91aa6dfd10fd847c469caebe63b35141ff'/>
<id>6cb42f91aa6dfd10fd847c469caebe63b35141ff</id>
<content type='text'>
Now that bitmap_*_region() functions are implemented as thin wrappers
around others, it's worth to move them to the header, as it opens room
for compile-time optimizations.

CC: Andy Shevchenko &lt;andriy.shevchenko@linux.intel.com&gt;
CC: Rasmus Villemoes &lt;linux@rasmusvillemoes.dk&gt;
CC: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
Signed-off-by: Yury Norov &lt;yury.norov@gmail.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Now that bitmap_*_region() functions are implemented as thin wrappers
around others, it's worth to move them to the header, as it opens room
for compile-time optimizations.

CC: Andy Shevchenko &lt;andriy.shevchenko@linux.intel.com&gt;
CC: Rasmus Villemoes &lt;linux@rasmusvillemoes.dk&gt;
CC: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
Signed-off-by: Yury Norov &lt;yury.norov@gmail.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>bitmap: drop _reg_op() function</title>
<updated>2023-10-15T03:25:23+00:00</updated>
<author>
<name>Yury Norov</name>
<email>yury.norov@gmail.com</email>
</author>
<published>2023-09-25T02:38:16+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=1d4836527d4168d648010909637fb6cfe45d3fac'/>
<id>1d4836527d4168d648010909637fb6cfe45d3fac</id>
<content type='text'>
Now that all _reg_op() users are switched to alternative functions,
_reg_op() machinery is not needed anymore.

CC: Andy Shevchenko &lt;andriy.shevchenko@linux.intel.com&gt;
CC: Rasmus Villemoes &lt;linux@rasmusvillemoes.dk&gt;
Signed-off-by: Yury Norov &lt;yury.norov@gmail.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Now that all _reg_op() users are switched to alternative functions,
_reg_op() machinery is not needed anymore.

CC: Andy Shevchenko &lt;andriy.shevchenko@linux.intel.com&gt;
CC: Rasmus Villemoes &lt;linux@rasmusvillemoes.dk&gt;
Signed-off-by: Yury Norov &lt;yury.norov@gmail.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>bitmap: replace _reg_op(REG_OP_ISFREE) with find_next_bit()</title>
<updated>2023-10-15T03:25:22+00:00</updated>
<author>
<name>Yury Norov</name>
<email>yury.norov@gmail.com</email>
</author>
<published>2023-09-25T02:38:15+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=9276819a68b52cf2577f77985041faf527cf477c'/>
<id>9276819a68b52cf2577f77985041faf527cf477c</id>
<content type='text'>
_reg_op(REG_OP_ISFREE) can be trivially replaced with find_next_bit().
Doing that opens room for potential small_const_nbits() optimization.

CC: Andy Shevchenko &lt;andriy.shevchenko@linux.intel.com&gt;
CC: Rasmus Villemoes &lt;linux@rasmusvillemoes.dk&gt;
Signed-off-by: Yury Norov &lt;yury.norov@gmail.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
_reg_op(REG_OP_ISFREE) can be trivially replaced with find_next_bit().
Doing that opens room for potential small_const_nbits() optimization.

CC: Andy Shevchenko &lt;andriy.shevchenko@linux.intel.com&gt;
CC: Rasmus Villemoes &lt;linux@rasmusvillemoes.dk&gt;
Signed-off-by: Yury Norov &lt;yury.norov@gmail.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>bitmap: replace _reg_op(REG_OP_RELEASE) with bitmap_clear()</title>
<updated>2023-10-15T03:25:22+00:00</updated>
<author>
<name>Yury Norov</name>
<email>yury.norov@gmail.com</email>
</author>
<published>2023-09-25T02:38:14+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=add00c76ee4dafbc35b170bea144358fd62daebb'/>
<id>add00c76ee4dafbc35b170bea144358fd62daebb</id>
<content type='text'>
_reg_op(REG_OP_RELEASE) duplicates bitmap_clear().

CC: Andy Shevchenko &lt;andriy.shevchenko@linux.intel.com&gt;
CC: Rasmus Villemoes &lt;linux@rasmusvillemoes.dk&gt;
Signed-off-by: Yury Norov &lt;yury.norov@gmail.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
_reg_op(REG_OP_RELEASE) duplicates bitmap_clear().

CC: Andy Shevchenko &lt;andriy.shevchenko@linux.intel.com&gt;
CC: Rasmus Villemoes &lt;linux@rasmusvillemoes.dk&gt;
Signed-off-by: Yury Norov &lt;yury.norov@gmail.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>bitmap: replace _reg_op(REG_OP_ALLOC) with bitmap_set()</title>
<updated>2023-10-15T03:25:22+00:00</updated>
<author>
<name>Yury Norov</name>
<email>yury.norov@gmail.com</email>
</author>
<published>2023-09-25T02:38:13+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=eae5acbd7572f2874cd2f04dd540870dca256826'/>
<id>eae5acbd7572f2874cd2f04dd540870dca256826</id>
<content type='text'>
_reg_op(REG_OP_ALLOC) duplicates bitmap_set().

CC: Andy Shevchenko &lt;andriy.shevchenko@linux.intel.com&gt;
CC: Rasmus Villemoes &lt;linux@rasmusvillemoes.dk&gt;
Signed-off-by: Yury Norov &lt;yury.norov@gmail.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
_reg_op(REG_OP_ALLOC) duplicates bitmap_set().

CC: Andy Shevchenko &lt;andriy.shevchenko@linux.intel.com&gt;
CC: Rasmus Villemoes &lt;linux@rasmusvillemoes.dk&gt;
Signed-off-by: Yury Norov &lt;yury.norov@gmail.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>bitmap: fix opencoded bitmap_allocate_region()</title>
<updated>2023-10-15T03:25:22+00:00</updated>
<author>
<name>Yury Norov</name>
<email>yury.norov@gmail.com</email>
</author>
<published>2023-09-25T02:38:12+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=b085f969ed3df1916b9d9029225f2472df33cc17'/>
<id>b085f969ed3df1916b9d9029225f2472df33cc17</id>
<content type='text'>
bitmap_find_region() opencodes bitmap_allocate_region().

CC: Andy Shevchenko &lt;andriy.shevchenko@linux.intel.com&gt;
CC: Rasmus Villemoes &lt;linux@rasmusvillemoes.dk&gt;
Signed-off-by: Yury Norov &lt;yury.norov@gmail.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
bitmap_find_region() opencodes bitmap_allocate_region().

CC: Andy Shevchenko &lt;andriy.shevchenko@linux.intel.com&gt;
CC: Rasmus Villemoes &lt;linux@rasmusvillemoes.dk&gt;
Signed-off-by: Yury Norov &lt;yury.norov@gmail.com&gt;
</pre>
</div>
</content>
</entry>
</feed>
