<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux.git/lib/test_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: 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>bitmap: exclude nbits == 0 cases from bitmap test</title>
<updated>2026-03-23T17:56:25+00:00</updated>
<author>
<name>Yury Norov</name>
<email>ynorov@nvidia.com</email>
</author>
<published>2026-03-19T00:43:47+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=2a4d3706d864d19ba8772b7a5e74328ac5c1007d'/>
<id>2a4d3706d864d19ba8772b7a5e74328ac5c1007d</id>
<content type='text'>
Bitmap API handles nbits == 0 in most cases correctly, i.e. it doesn't
dereferene underlying bitmap and returns a sane value where convenient,
or implementation defined, or undef.

Implicitly testing nbits == 0 case, however, may make an impression that
this is a regular case. This is wrong. In most cases nbits == 0 is a
sign of an error on a client side. The tests should not make such an
implression.

This patch reworks the existing tests to not test nbits == 0. The
following patch adds an explicit test for it with an appropriate
precaution.

Signed-off-by: Yury Norov &lt;ynorov@nvidia.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Bitmap API handles nbits == 0 in most cases correctly, i.e. it doesn't
dereferene underlying bitmap and returns a sane value where convenient,
or implementation defined, or undef.

Implicitly testing nbits == 0 case, however, may make an impression that
this is a regular case. This is wrong. In most cases nbits == 0 is a
sign of an error on a client side. The tests should not make such an
implression.

This patch reworks the existing tests to not test nbits == 0. The
following patch adds an explicit test for it with an appropriate
precaution.

Signed-off-by: Yury Norov &lt;ynorov@nvidia.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>bitmap: test bitmap_weight() for more</title>
<updated>2026-03-23T17:56:25+00:00</updated>
<author>
<name>Yury Norov</name>
<email>ynorov@nvidia.com</email>
</author>
<published>2026-03-19T00:43:46+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=e9cf8f83c9857a32494002c72b5f6e36ff4dfcd5'/>
<id>e9cf8f83c9857a32494002c72b5f6e36ff4dfcd5</id>
<content type='text'>
Test the function for correctness when some bits are set in the last word
of bitmap beyond nbits. This is motivated by commit a9dadc1c512807f9
("powerpc/xive: Fix the size of the cpumask used in
xive_find_target_in_mask()").

Signed-off-by: Yury Norov &lt;ynorov@nvidia.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Test the function for correctness when some bits are set in the last word
of bitmap beyond nbits. This is motivated by commit a9dadc1c512807f9
("powerpc/xive: Fix the size of the cpumask used in
xive_find_target_in_mask()").

Signed-off-by: Yury Norov &lt;ynorov@nvidia.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>bitmap: add bitmap_weight_from()</title>
<updated>2026-03-23T17:33:51+00:00</updated>
<author>
<name>Yury Norov</name>
<email>ynorov@nvidia.com</email>
</author>
<published>2025-12-22T19:11:37+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=bf31ddc14f8c6bcd4987c31fe2bc9e93e433b41a'/>
<id>bf31ddc14f8c6bcd4987c31fe2bc9e93e433b41a</id>
<content type='text'>
The function calculates a Hamming weight of a bitmap starting from an
arbitrary bit.

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 calculates a Hamming weight of a bitmap starting from an
arbitrary bit.

Signed-off-by: Yury Norov &lt;ynorov@nvidia.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>bitmap: align test_bitmap output</title>
<updated>2026-03-23T17:33:51+00:00</updated>
<author>
<name>Yury Norov</name>
<email>ynorov@nvidia.com</email>
</author>
<published>2026-02-19T18:13:58+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=e63375d39a2e90edc25e96560f14d28193347b04'/>
<id>e63375d39a2e90edc25e96560f14d28193347b04</id>
<content type='text'>
Different subtests print output in slightly different formats. Unify the
format for better visual representation.

The test output before:

[    0.553474] test_bitmap: parselist: 14: input is '0-2047:128/256' OK, Time: 202
[    0.555121] test_bitmap: bitmap_print_to_pagebuf: input is '0-32767
[    0.555121] ', Time: 1278
[    0.578392] test_bitmap: Time spent in test_bitmap_read_perf:	427864
[    0.580137] test_bitmap: Time spent in test_bitmap_write_perf:	793554
[    0.581957] test_bitmap: all 390447 tests passed

And after:

[    0.314982] test_bitmap: parselist('0-2047:128/256'):	135
[    0.315517] test_bitmap: scnprintf("%*pbl", '0-32767'):	342
[    0.330045] test_bitmap: test_bitmap_read_perf:		252294
[    0.331132] test_bitmap: test_bitmap_write_perf:		539001
[    0.332163] test_bitmap: all 390447 tests passed

Signed-off-by: Yury Norov &lt;ynorov@nvidia.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Different subtests print output in slightly different formats. Unify the
format for better visual representation.

The test output before:

[    0.553474] test_bitmap: parselist: 14: input is '0-2047:128/256' OK, Time: 202
[    0.555121] test_bitmap: bitmap_print_to_pagebuf: input is '0-32767
[    0.555121] ', Time: 1278
[    0.578392] test_bitmap: Time spent in test_bitmap_read_perf:	427864
[    0.580137] test_bitmap: Time spent in test_bitmap_write_perf:	793554
[    0.581957] test_bitmap: all 390447 tests passed

And after:

[    0.314982] test_bitmap: parselist('0-2047:128/256'):	135
[    0.315517] test_bitmap: scnprintf("%*pbl", '0-32767'):	342
[    0.330045] test_bitmap: test_bitmap_read_perf:		252294
[    0.331132] test_bitmap: test_bitmap_write_perf:		539001
[    0.332163] test_bitmap: all 390447 tests passed

Signed-off-by: Yury Norov &lt;ynorov@nvidia.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>bitmap: switch test to scnprintf("%*pbl")</title>
<updated>2026-03-23T17:33:51+00:00</updated>
<author>
<name>Yury Norov</name>
<email>ynorov@nvidia.com</email>
</author>
<published>2026-02-19T18:13:57+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=d1a43793c484e4f1e896dd2fee52b034f8c4f965'/>
<id>d1a43793c484e4f1e896dd2fee52b034f8c4f965</id>
<content type='text'>
scnprintf("%*pbl") is more verbose than bitmap_print_to_pagebuf().
Switch the test to using it. This also improves the test output
because bitmap_print_to_pagebuf() adds \n at the end of the printed
bitmap, which breaks the test format.

Signed-off-by: Yury Norov &lt;ynorov@nvidia.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
scnprintf("%*pbl") is more verbose than bitmap_print_to_pagebuf().
Switch the test to using it. This also improves the test output
because bitmap_print_to_pagebuf() adds \n at the end of the printed
bitmap, which breaks the test format.

Signed-off-by: Yury Norov &lt;ynorov@nvidia.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>bitmap: Add test for out-of-boundary modifications for scatter &amp; gather</title>
<updated>2026-03-23T17:33:51+00:00</updated>
<author>
<name>Andy Shevchenko</name>
<email>andriy.shevchenko@linux.intel.com</email>
</author>
<published>2026-02-26T11:16:44+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=6b5a4b68736798df1031404a2fad06d031253ef7'/>
<id>6b5a4b68736798df1031404a2fad06d031253ef7</id>
<content type='text'>
Make sure that bitmap_scatter() and bitmap_gather() do not modify
the bits outside of the given nbits span.

Signed-off-by: Andy Shevchenko &lt;andriy.shevchenko@linux.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>
Make sure that bitmap_scatter() and bitmap_gather() do not modify
the bits outside of the given nbits span.

Signed-off-by: Andy Shevchenko &lt;andriy.shevchenko@linux.intel.com&gt;
Signed-off-by: Yury Norov &lt;ynorov@nvidia.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>bitmap: remove _check_eq_u32_array</title>
<updated>2025-02-18T16:51:21+00:00</updated>
<author>
<name>Tamir Duberstein</name>
<email>tamird@gmail.com</email>
</author>
<published>2025-02-07T20:14:02+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=158e9d2f3366976d74a500dbbba633036ba8501b'/>
<id>158e9d2f3366976d74a500dbbba633036ba8501b</id>
<content type='text'>
This has been unused since commit 3aa56885e516 ("bitmap: replace
bitmap_{from,to}_u32array") in 2018.

Signed-off-by: Tamir Duberstein &lt;tamird@gmail.com&gt;
Reviewed-by: David Gow &lt;davidgow@google.com&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>
This has been unused since commit 3aa56885e516 ("bitmap: replace
bitmap_{from,to}_u32array") in 2018.

Signed-off-by: Tamir Duberstein &lt;tamird@gmail.com&gt;
Reviewed-by: David Gow &lt;davidgow@google.com&gt;
Signed-off-by: Yury Norov &lt;yury.norov@gmail.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>lib: bitmap: add missing MODULE_DESCRIPTION() macros</title>
<updated>2024-06-18T17:40:52+00:00</updated>
<author>
<name>Jeff Johnson</name>
<email>quic_jjohnson@quicinc.com</email>
</author>
<published>2024-05-31T16:03:11+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=e334771d83ec14f755a554394162198a955e3faa'/>
<id>e334771d83ec14f755a554394162198a955e3faa</id>
<content type='text'>
make allmodconfig &amp;&amp; make W=1 C=1 reports:
WARNING: modpost: missing MODULE_DESCRIPTION() in lib/find_bit_benchmark.o
WARNING: modpost: missing MODULE_DESCRIPTION() in lib/cpumask_kunit.o
WARNING: modpost: missing MODULE_DESCRIPTION() in lib/test_bitmap.o

Add the missing invocations of the MODULE_DESCRIPTION() macro.

Signed-off-by: Jeff Johnson &lt;quic_jjohnson@quicinc.com&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>
make allmodconfig &amp;&amp; make W=1 C=1 reports:
WARNING: modpost: missing MODULE_DESCRIPTION() in lib/find_bit_benchmark.o
WARNING: modpost: missing MODULE_DESCRIPTION() in lib/cpumask_kunit.o
WARNING: modpost: missing MODULE_DESCRIPTION() in lib/test_bitmap.o

Add the missing invocations of the MODULE_DESCRIPTION() macro.

Signed-off-by: Jeff Johnson &lt;quic_jjohnson@quicinc.com&gt;
Signed-off-by: Yury Norov &lt;yury.norov@gmail.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Merge tag 'bitmap-for-6.10v2' of https://github.com/norov/linux</title>
<updated>2024-05-21T22:29:01+00:00</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2024-05-21T22:29:01+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=4865a27c66fda6a32511ec5492f4bbec437f512d'/>
<id>4865a27c66fda6a32511ec5492f4bbec437f512d</id>
<content type='text'>
Pull bitmap updates from Yury Norov:

 - topology_span_sane() optimization from Kyle Meyer

 - fns() rework from Kuan-Wei Chiu (used in cpumask_local_spread() and
   other places)

 - headers cleanup from Andy

 - add a MAINTAINERS record for bitops API

* tag 'bitmap-for-6.10v2' of https://github.com/norov/linux:
  usercopy: Don't use "proxy" headers
  bitops: Move aligned_byte_mask() to wordpart.h
  MAINTAINERS: add BITOPS API record
  bitmap: relax find_nth_bit() limitation on return value
  lib: make test_bitops compilable into the kernel image
  bitops: Optimize fns() for improved performance
  lib/test_bitops: Add benchmark test for fns()
  Compiler Attributes: Add __always_used macro
  sched/topology: Optimize topology_span_sane()
  cpumask: Add for_each_cpu_from()
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Pull bitmap updates from Yury Norov:

 - topology_span_sane() optimization from Kyle Meyer

 - fns() rework from Kuan-Wei Chiu (used in cpumask_local_spread() and
   other places)

 - headers cleanup from Andy

 - add a MAINTAINERS record for bitops API

* tag 'bitmap-for-6.10v2' of https://github.com/norov/linux:
  usercopy: Don't use "proxy" headers
  bitops: Move aligned_byte_mask() to wordpart.h
  MAINTAINERS: add BITOPS API record
  bitmap: relax find_nth_bit() limitation on return value
  lib: make test_bitops compilable into the kernel image
  bitops: Optimize fns() for improved performance
  lib/test_bitops: Add benchmark test for fns()
  Compiler Attributes: Add __always_used macro
  sched/topology: Optimize topology_span_sane()
  cpumask: Add for_each_cpu_from()
</pre>
</div>
</content>
</entry>
</feed>
