Skip to content

Commit 4ba281d

Browse files
norovtorvalds
authored andcommitted
lib/find_bit_benchmark.c: avoid soft lockup in test_find_first_bit()
test_find_first_bit() is intentionally sub-optimal, and may cause soft lockup due to long time of run on some systems. So decrease length of bitmap to traverse to avoid lockup. With the change below, time of test execution doesn't exceed 0.2 seconds on my testing system. Link: http://lkml.kernel.org/r/20180420171949.15710-1-ynorov@caviumnetworks.com Fixes: 4441fca ("lib: test module for find_*_bit() functions") Signed-off-by: Yury Norov <ynorov@caviumnetworks.com> Reviewed-by: Andrew Morton <akpm@linux-foundation.org> Reported-by: Fengguang Wu <fengguang.wu@intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent c9cf87e commit 4ba281d

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

‎lib/find_bit_benchmark.c‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,12 @@ static int __init find_bit_test(void)
132132
test_find_next_bit(bitmap, BITMAP_LEN);
133133
test_find_next_zero_bit(bitmap, BITMAP_LEN);
134134
test_find_last_bit(bitmap, BITMAP_LEN);
135-
test_find_first_bit(bitmap, BITMAP_LEN);
135+
136+
/*
137+
* test_find_first_bit() may take some time, so
138+
* traverse only part of bitmap to avoid soft lockup.
139+
*/
140+
test_find_first_bit(bitmap, BITMAP_LEN / 10);
136141
test_find_next_and_bit(bitmap, bitmap2, BITMAP_LEN);
137142

138143
pr_err("\nStart testing find_bit() with sparse bitmap\n");

0 commit comments

Comments
 (0)