aboutsummaryrefslogtreecommitdiffstats
path: root/lib/find_bit_benchmark.c
diff options
context:
space:
mode:
authorYury Norov <ynorov@caviumnetworks.com>2018-05-11 19:01:39 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2018-05-11 20:28:45 -0400
commit4ba281d5bd9907355e6b79fb72049c9ed50cc670 (patch)
tree6a73a06297cbc2ddb52d7ab06085549964676e45 /lib/find_bit_benchmark.c
parentc9cf87ea6a4725bc586cc5776c3fb6042a264b7d (diff)
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: 4441fca0a27f5 ("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>
Diffstat (limited to 'lib/find_bit_benchmark.c')
-rw-r--r--lib/find_bit_benchmark.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/find_bit_benchmark.c b/lib/find_bit_benchmark.c
index 5985a25e6cbc..5367ffa5c18f 100644
--- a/lib/find_bit_benchmark.c
+++ b/lib/find_bit_benchmark.c
@@ -132,7 +132,12 @@ static int __init find_bit_test(void)
132 test_find_next_bit(bitmap, BITMAP_LEN); 132 test_find_next_bit(bitmap, BITMAP_LEN);
133 test_find_next_zero_bit(bitmap, BITMAP_LEN); 133 test_find_next_zero_bit(bitmap, BITMAP_LEN);
134 test_find_last_bit(bitmap, BITMAP_LEN); 134 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);
136 test_find_next_and_bit(bitmap, bitmap2, BITMAP_LEN); 141 test_find_next_and_bit(bitmap, bitmap2, BITMAP_LEN);
137 142
138 pr_err("\nStart testing find_bit() with sparse bitmap\n"); 143 pr_err("\nStart testing find_bit() with sparse bitmap\n");