diff options
| author | Akinobu Mita <akinobu.mita@gmail.com> | 2026-03-11 00:21:26 +0900 |
|---|---|---|
| committer | Yury Norov <ynorov@nvidia.com> | 2026-03-23 13:33:51 -0400 |
| commit | 6c88ba561cfc2c5f35067519f46310059a9dc39a (patch) | |
| tree | 8b174aba2f465f139c688485c34b895e3faec617 /include/asm-x86/git@git.tavy.me:linux.git | |
| parent | a676643709115816d3ce7e50aa5b5a4af1ee6c45 (diff) | |
lib/find_bit_benchmark: avoid clearing randomly filled bitmap in test_find_first_bit()
test_find_first_bit() searches for a set bit from the beginning of the
test bitmap and clears it repeatedly, eventually clearing the entire
bitmap.
After test_find_first_bit() is executed, test_find_first_and_bit() and
test_find_next_and_bit() are executed without randomly reinitializing the
cleared bitmap.
In the first phase (testing find_bit() with a random-filled bitmap),
test_find_first_bit() only operates on 1/10 of the entire size of the
testing bitmap, so this isn't a big problem.
However, in the second phase (testing find_bit() with a sparse bitmap),
test_find_first_bit() clears the entire test bitmap, so the subsequent
test_find_first_and_bit() and test_find_next_and_bit() will not find any
set bits. This is probably not the intended benchmark.
To fix this issue, test_find_first_bit() operates on a duplicated bitmap
and does not clear the original test bitmap.
The same is already done in test_find_first_and_bit().
While we're at it, add const qualifiers to the bitmap pointer arguments
in the test functions.
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Signed-off-by: Yury Norov <ynorov@nvidia.com>
Diffstat (limited to 'include/asm-x86/git@git.tavy.me:linux.git')
0 files changed, 0 insertions, 0 deletions
