diff options
author | Rehas Sachdeva <aquannie@gmail.com> | 2017-01-04 11:55:00 -0500 |
---|---|---|
committer | Matthew Wilcox <mawilcox@microsoft.com> | 2017-02-13 21:44:04 -0500 |
commit | 73bc029b76482260a144219786d19951f561716e (patch) | |
tree | 92fd2111d3da8e9eea6d43f926f5b9368f924d82 /tools | |
parent | 5eeb2d23df29212f901a36dabf16f93d8bd50814 (diff) |
radix tree test suite: Dial down verbosity with -v
Make the output of radix tree test suite less verbose by default and add
-v and -vv command line options for increasing level of verbosity.
Signed-off-by: Rehas Sachdeva <aquannie@gmail.com>
Signed-off-by: Matthew Wilcox <mawilcox@microsoft.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/testing/radix-tree/benchmark.c | 6 | ||||
-rw-r--r-- | tools/testing/radix-tree/iteration_check.c | 2 | ||||
-rw-r--r-- | tools/testing/radix-tree/linux.c | 1 | ||||
-rw-r--r-- | tools/testing/radix-tree/linux/radix-tree.h | 6 | ||||
-rw-r--r-- | tools/testing/radix-tree/main.c | 45 | ||||
-rw-r--r-- | tools/testing/radix-tree/multiorder.c | 17 | ||||
-rw-r--r-- | tools/testing/radix-tree/regression1.c | 4 | ||||
-rw-r--r-- | tools/testing/radix-tree/regression2.c | 4 | ||||
-rw-r--r-- | tools/testing/radix-tree/regression3.c | 28 | ||||
-rw-r--r-- | tools/testing/radix-tree/tag_check.c | 22 |
10 files changed, 77 insertions, 58 deletions
diff --git a/tools/testing/radix-tree/benchmark.c b/tools/testing/radix-tree/benchmark.c index 215ca86c7605..9b09ddfe462f 100644 --- a/tools/testing/radix-tree/benchmark.c +++ b/tools/testing/radix-tree/benchmark.c | |||
@@ -71,7 +71,7 @@ static void benchmark_size(unsigned long size, unsigned long step, int order) | |||
71 | tagged = benchmark_iter(&tree, true); | 71 | tagged = benchmark_iter(&tree, true); |
72 | normal = benchmark_iter(&tree, false); | 72 | normal = benchmark_iter(&tree, false); |
73 | 73 | ||
74 | printf("Size %ld, step %6ld, order %d tagged %10lld ns, normal %10lld ns\n", | 74 | printv(2, "Size %ld, step %6ld, order %d tagged %10lld ns, normal %10lld ns\n", |
75 | size, step, order, tagged, normal); | 75 | size, step, order, tagged, normal); |
76 | 76 | ||
77 | item_kill_tree(&tree); | 77 | item_kill_tree(&tree); |
@@ -85,8 +85,8 @@ void benchmark(void) | |||
85 | 128, 256, 512, 12345, 0}; | 85 | 128, 256, 512, 12345, 0}; |
86 | int c, s; | 86 | int c, s; |
87 | 87 | ||
88 | printf("starting benchmarks\n"); | 88 | printv(1, "starting benchmarks\n"); |
89 | printf("RADIX_TREE_MAP_SHIFT = %d\n", RADIX_TREE_MAP_SHIFT); | 89 | printv(1, "RADIX_TREE_MAP_SHIFT = %d\n", RADIX_TREE_MAP_SHIFT); |
90 | 90 | ||
91 | for (c = 0; size[c]; c++) | 91 | for (c = 0; size[c]; c++) |
92 | for (s = 0; step[s]; s++) | 92 | for (s = 0; step[s]; s++) |
diff --git a/tools/testing/radix-tree/iteration_check.c b/tools/testing/radix-tree/iteration_check.c index 7572b7ed930e..a92bab513701 100644 --- a/tools/testing/radix-tree/iteration_check.c +++ b/tools/testing/radix-tree/iteration_check.c | |||
@@ -177,7 +177,7 @@ void iteration_test(unsigned order, unsigned test_duration) | |||
177 | { | 177 | { |
178 | int i; | 178 | int i; |
179 | 179 | ||
180 | printf("Running %siteration tests for %d seconds\n", | 180 | printv(1, "Running %siteration tests for %d seconds\n", |
181 | order > 0 ? "multiorder " : "", test_duration); | 181 | order > 0 ? "multiorder " : "", test_duration); |
182 | 182 | ||
183 | max_order = order; | 183 | max_order = order; |
diff --git a/tools/testing/radix-tree/linux.c b/tools/testing/radix-tree/linux.c index 3e4f9f36da2e..94bcdb992bbf 100644 --- a/tools/testing/radix-tree/linux.c +++ b/tools/testing/radix-tree/linux.c | |||
@@ -14,6 +14,7 @@ | |||
14 | int nr_allocated; | 14 | int nr_allocated; |
15 | int preempt_count; | 15 | int preempt_count; |
16 | int kmalloc_verbose; | 16 | int kmalloc_verbose; |
17 | int test_verbose; | ||
17 | 18 | ||
18 | struct kmem_cache { | 19 | struct kmem_cache { |
19 | pthread_mutex_t lock; | 20 | pthread_mutex_t lock; |
diff --git a/tools/testing/radix-tree/linux/radix-tree.h b/tools/testing/radix-tree/linux/radix-tree.h index f4d8532e1bef..ddd135fa3af7 100644 --- a/tools/testing/radix-tree/linux/radix-tree.h +++ b/tools/testing/radix-tree/linux/radix-tree.h | |||
@@ -3,6 +3,7 @@ | |||
3 | #include "../../../../include/linux/radix-tree.h" | 3 | #include "../../../../include/linux/radix-tree.h" |
4 | 4 | ||
5 | extern int kmalloc_verbose; | 5 | extern int kmalloc_verbose; |
6 | extern int test_verbose; | ||
6 | 7 | ||
7 | static inline void trace_call_rcu(struct rcu_head *head, | 8 | static inline void trace_call_rcu(struct rcu_head *head, |
8 | void (*func)(struct rcu_head *head)) | 9 | void (*func)(struct rcu_head *head)) |
@@ -12,6 +13,11 @@ static inline void trace_call_rcu(struct rcu_head *head, | |||
12 | offsetof(struct radix_tree_node, rcu_head)); | 13 | offsetof(struct radix_tree_node, rcu_head)); |
13 | call_rcu(head, func); | 14 | call_rcu(head, func); |
14 | } | 15 | } |
16 | |||
17 | #define printv(verbosity_level, fmt, ...) \ | ||
18 | if(test_verbose >= verbosity_level) \ | ||
19 | printf(fmt, ##__VA_ARGS__) | ||
20 | |||
15 | #undef call_rcu | 21 | #undef call_rcu |
16 | #define call_rcu(x, y) trace_call_rcu(x, y) | 22 | #define call_rcu(x, y) trace_call_rcu(x, y) |
17 | 23 | ||
diff --git a/tools/testing/radix-tree/main.c b/tools/testing/radix-tree/main.c index ddd90a11db3f..86de448b699e 100644 --- a/tools/testing/radix-tree/main.c +++ b/tools/testing/radix-tree/main.c | |||
@@ -68,7 +68,7 @@ void big_gang_check(bool long_run) | |||
68 | 68 | ||
69 | for (i = 0; i < (long_run ? 1000 : 3); i++) { | 69 | for (i = 0; i < (long_run ? 1000 : 3); i++) { |
70 | __big_gang_check(); | 70 | __big_gang_check(); |
71 | printf("%d ", i); | 71 | printv(2, "%d ", i); |
72 | fflush(stdout); | 72 | fflush(stdout); |
73 | } | 73 | } |
74 | } | 74 | } |
@@ -129,14 +129,19 @@ void check_copied_tags(struct radix_tree_root *tree, unsigned long start, unsign | |||
129 | putchar('.'); */ | 129 | putchar('.'); */ |
130 | if (idx[i] < start || idx[i] > end) { | 130 | if (idx[i] < start || idx[i] > end) { |
131 | if (item_tag_get(tree, idx[i], totag)) { | 131 | if (item_tag_get(tree, idx[i], totag)) { |
132 | printf("%lu-%lu: %lu, tags %d-%d\n", start, end, idx[i], item_tag_get(tree, idx[i], fromtag), item_tag_get(tree, idx[i], totag)); | 132 | printv(2, "%lu-%lu: %lu, tags %d-%d\n", start, |
133 | end, idx[i], item_tag_get(tree, idx[i], | ||
134 | fromtag), | ||
135 | item_tag_get(tree, idx[i], totag)); | ||
133 | } | 136 | } |
134 | assert(!item_tag_get(tree, idx[i], totag)); | 137 | assert(!item_tag_get(tree, idx[i], totag)); |
135 | continue; | 138 | continue; |
136 | } | 139 | } |
137 | if (item_tag_get(tree, idx[i], fromtag) ^ | 140 | if (item_tag_get(tree, idx[i], fromtag) ^ |
138 | item_tag_get(tree, idx[i], totag)) { | 141 | item_tag_get(tree, idx[i], totag)) { |
139 | printf("%lu-%lu: %lu, tags %d-%d\n", start, end, idx[i], item_tag_get(tree, idx[i], fromtag), item_tag_get(tree, idx[i], totag)); | 142 | printv(2, "%lu-%lu: %lu, tags %d-%d\n", start, end, |
143 | idx[i], item_tag_get(tree, idx[i], fromtag), | ||
144 | item_tag_get(tree, idx[i], totag)); | ||
140 | } | 145 | } |
141 | assert(!(item_tag_get(tree, idx[i], fromtag) ^ | 146 | assert(!(item_tag_get(tree, idx[i], fromtag) ^ |
142 | item_tag_get(tree, idx[i], totag))); | 147 | item_tag_get(tree, idx[i], totag))); |
@@ -238,7 +243,7 @@ static void __locate_check(struct radix_tree_root *tree, unsigned long index, | |||
238 | item = item_lookup(tree, index); | 243 | item = item_lookup(tree, index); |
239 | index2 = find_item(tree, item); | 244 | index2 = find_item(tree, item); |
240 | if (index != index2) { | 245 | if (index != index2) { |
241 | printf("index %ld order %d inserted; found %ld\n", | 246 | printv(2, "index %ld order %d inserted; found %ld\n", |
242 | index, order, index2); | 247 | index, order, index2); |
243 | abort(); | 248 | abort(); |
244 | } | 249 | } |
@@ -289,48 +294,48 @@ static void single_thread_tests(bool long_run) | |||
289 | { | 294 | { |
290 | int i; | 295 | int i; |
291 | 296 | ||
292 | printf("starting single_thread_tests: %d allocated, preempt %d\n", | 297 | printv(1, "starting single_thread_tests: %d allocated, preempt %d\n", |
293 | nr_allocated, preempt_count); | 298 | nr_allocated, preempt_count); |
294 | multiorder_checks(); | 299 | multiorder_checks(); |
295 | rcu_barrier(); | 300 | rcu_barrier(); |
296 | printf("after multiorder_check: %d allocated, preempt %d\n", | 301 | printv(2, "after multiorder_check: %d allocated, preempt %d\n", |
297 | nr_allocated, preempt_count); | 302 | nr_allocated, preempt_count); |
298 | locate_check(); | 303 | locate_check(); |
299 | rcu_barrier(); | 304 | rcu_barrier(); |
300 | printf("after locate_check: %d allocated, preempt %d\n", | 305 | printv(2, "after locate_check: %d allocated, preempt %d\n", |
301 | nr_allocated, preempt_count); | 306 | nr_allocated, preempt_count); |
302 | tag_check(); | 307 | tag_check(); |
303 | rcu_barrier(); | 308 | rcu_barrier(); |
304 | printf("after tag_check: %d allocated, preempt %d\n", | 309 | printv(2, "after tag_check: %d allocated, preempt %d\n", |
305 | nr_allocated, preempt_count); | 310 | nr_allocated, preempt_count); |
306 | gang_check(); | 311 | gang_check(); |
307 | rcu_barrier(); | 312 | rcu_barrier(); |
308 | printf("after gang_check: %d allocated, preempt %d\n", | 313 | printv(2, "after gang_check: %d allocated, preempt %d\n", |
309 | nr_allocated, preempt_count); | 314 | nr_allocated, preempt_count); |
310 | add_and_check(); | 315 | add_and_check(); |
311 | rcu_barrier(); | 316 | rcu_barrier(); |
312 | printf("after add_and_check: %d allocated, preempt %d\n", | 317 | printv(2, "after add_and_check: %d allocated, preempt %d\n", |
313 | nr_allocated, preempt_count); | 318 | nr_allocated, preempt_count); |
314 | dynamic_height_check(); | 319 | dynamic_height_check(); |
315 | rcu_barrier(); | 320 | rcu_barrier(); |
316 | printf("after dynamic_height_check: %d allocated, preempt %d\n", | 321 | printv(2, "after dynamic_height_check: %d allocated, preempt %d\n", |
317 | nr_allocated, preempt_count); | 322 | nr_allocated, preempt_count); |
318 | idr_checks(); | 323 | idr_checks(); |
319 | ida_checks(); | 324 | ida_checks(); |
320 | rcu_barrier(); | 325 | rcu_barrier(); |
321 | printf("after idr_checks: %d allocated, preempt %d\n", | 326 | printv(2, "after idr_checks: %d allocated, preempt %d\n", |
322 | nr_allocated, preempt_count); | 327 | nr_allocated, preempt_count); |
323 | big_gang_check(long_run); | 328 | big_gang_check(long_run); |
324 | rcu_barrier(); | 329 | rcu_barrier(); |
325 | printf("after big_gang_check: %d allocated, preempt %d\n", | 330 | printv(2, "after big_gang_check: %d allocated, preempt %d\n", |
326 | nr_allocated, preempt_count); | 331 | nr_allocated, preempt_count); |
327 | for (i = 0; i < (long_run ? 2000 : 3); i++) { | 332 | for (i = 0; i < (long_run ? 2000 : 3); i++) { |
328 | copy_tag_check(); | 333 | copy_tag_check(); |
329 | printf("%d ", i); | 334 | printv(2, "%d ", i); |
330 | fflush(stdout); | 335 | fflush(stdout); |
331 | } | 336 | } |
332 | rcu_barrier(); | 337 | rcu_barrier(); |
333 | printf("after copy_tag_check: %d allocated, preempt %d\n", | 338 | printv(2, "after copy_tag_check: %d allocated, preempt %d\n", |
334 | nr_allocated, preempt_count); | 339 | nr_allocated, preempt_count); |
335 | } | 340 | } |
336 | 341 | ||
@@ -340,16 +345,20 @@ int main(int argc, char **argv) | |||
340 | int opt; | 345 | int opt; |
341 | unsigned int seed = time(NULL); | 346 | unsigned int seed = time(NULL); |
342 | 347 | ||
343 | while ((opt = getopt(argc, argv, "ls:")) != -1) { | 348 | while ((opt = getopt(argc, argv, "ls:v")) != -1) { |
344 | if (opt == 'l') | 349 | if (opt == 'l') |
345 | long_run = true; | 350 | long_run = true; |
346 | else if (opt == 's') | 351 | else if (opt == 's') |
347 | seed = strtoul(optarg, NULL, 0); | 352 | seed = strtoul(optarg, NULL, 0); |
353 | else if (opt == 'v') | ||
354 | test_verbose++; | ||
348 | } | 355 | } |
349 | 356 | ||
350 | printf("random seed %u\n", seed); | 357 | printf("random seed %u\n", seed); |
351 | srand(seed); | 358 | srand(seed); |
352 | 359 | ||
360 | printf("running tests\n"); | ||
361 | |||
353 | rcu_register_thread(); | 362 | rcu_register_thread(); |
354 | radix_tree_init(); | 363 | radix_tree_init(); |
355 | 364 | ||
@@ -366,9 +375,11 @@ int main(int argc, char **argv) | |||
366 | benchmark(); | 375 | benchmark(); |
367 | 376 | ||
368 | rcu_barrier(); | 377 | rcu_barrier(); |
369 | printf("after rcu_barrier: %d allocated, preempt %d\n", | 378 | printv(2, "after rcu_barrier: %d allocated, preempt %d\n", |
370 | nr_allocated, preempt_count); | 379 | nr_allocated, preempt_count); |
371 | rcu_unregister_thread(); | 380 | rcu_unregister_thread(); |
372 | 381 | ||
382 | printf("tests completed\n"); | ||
383 | |||
373 | exit(0); | 384 | exit(0); |
374 | } | 385 | } |
diff --git a/tools/testing/radix-tree/multiorder.c b/tools/testing/radix-tree/multiorder.c index e465a3811b97..72d80f7059d3 100644 --- a/tools/testing/radix-tree/multiorder.c +++ b/tools/testing/radix-tree/multiorder.c | |||
@@ -30,7 +30,7 @@ static void __multiorder_tag_test(int index, int order) | |||
30 | /* our canonical entry */ | 30 | /* our canonical entry */ |
31 | base = index & ~((1 << order) - 1); | 31 | base = index & ~((1 << order) - 1); |
32 | 32 | ||
33 | printf("Multiorder tag test with index %d, canonical entry %d\n", | 33 | printv(2, "Multiorder tag test with index %d, canonical entry %d\n", |
34 | index, base); | 34 | index, base); |
35 | 35 | ||
36 | err = item_insert_order(&tree, index, order); | 36 | err = item_insert_order(&tree, index, order); |
@@ -150,7 +150,7 @@ static void multiorder_check(unsigned long index, int order) | |||
150 | struct item *item2 = item_create(min, order); | 150 | struct item *item2 = item_create(min, order); |
151 | RADIX_TREE(tree, GFP_KERNEL); | 151 | RADIX_TREE(tree, GFP_KERNEL); |
152 | 152 | ||
153 | printf("Multiorder index %ld, order %d\n", index, order); | 153 | printv(2, "Multiorder index %ld, order %d\n", index, order); |
154 | 154 | ||
155 | assert(item_insert_order(&tree, index, order) == 0); | 155 | assert(item_insert_order(&tree, index, order) == 0); |
156 | 156 | ||
@@ -188,7 +188,7 @@ static void multiorder_shrink(unsigned long index, int order) | |||
188 | RADIX_TREE(tree, GFP_KERNEL); | 188 | RADIX_TREE(tree, GFP_KERNEL); |
189 | struct radix_tree_node *node; | 189 | struct radix_tree_node *node; |
190 | 190 | ||
191 | printf("Multiorder shrink index %ld, order %d\n", index, order); | 191 | printv(2, "Multiorder shrink index %ld, order %d\n", index, order); |
192 | 192 | ||
193 | assert(item_insert_order(&tree, 0, order) == 0); | 193 | assert(item_insert_order(&tree, 0, order) == 0); |
194 | 194 | ||
@@ -209,7 +209,8 @@ static void multiorder_shrink(unsigned long index, int order) | |||
209 | item_check_absent(&tree, i); | 209 | item_check_absent(&tree, i); |
210 | 210 | ||
211 | if (!item_delete(&tree, 0)) { | 211 | if (!item_delete(&tree, 0)) { |
212 | printf("failed to delete index %ld (order %d)\n", index, order); abort(); | 212 | printv(2, "failed to delete index %ld (order %d)\n", index, order); |
213 | abort(); | ||
213 | } | 214 | } |
214 | 215 | ||
215 | for (i = 0; i < 2*max; i++) | 216 | for (i = 0; i < 2*max; i++) |
@@ -234,7 +235,7 @@ void multiorder_iteration(void) | |||
234 | void **slot; | 235 | void **slot; |
235 | int i, j, err; | 236 | int i, j, err; |
236 | 237 | ||
237 | printf("Multiorder iteration test\n"); | 238 | printv(1, "Multiorder iteration test\n"); |
238 | 239 | ||
239 | #define NUM_ENTRIES 11 | 240 | #define NUM_ENTRIES 11 |
240 | int index[NUM_ENTRIES] = {0, 2, 4, 8, 16, 32, 34, 36, 64, 72, 128}; | 241 | int index[NUM_ENTRIES] = {0, 2, 4, 8, 16, 32, 34, 36, 64, 72, 128}; |
@@ -275,7 +276,7 @@ void multiorder_tagged_iteration(void) | |||
275 | void **slot; | 276 | void **slot; |
276 | int i, j; | 277 | int i, j; |
277 | 278 | ||
278 | printf("Multiorder tagged iteration test\n"); | 279 | printv(1, "Multiorder tagged iteration test\n"); |
279 | 280 | ||
280 | #define MT_NUM_ENTRIES 9 | 281 | #define MT_NUM_ENTRIES 9 |
281 | int index[MT_NUM_ENTRIES] = {0, 2, 4, 16, 32, 40, 64, 72, 128}; | 282 | int index[MT_NUM_ENTRIES] = {0, 2, 4, 16, 32, 40, 64, 72, 128}; |
@@ -453,7 +454,7 @@ static void check_mem(unsigned old_order, unsigned new_order, unsigned alloc) | |||
453 | { | 454 | { |
454 | struct radix_tree_preload *rtp = &radix_tree_preloads; | 455 | struct radix_tree_preload *rtp = &radix_tree_preloads; |
455 | if (rtp->nr != 0) | 456 | if (rtp->nr != 0) |
456 | printf("split(%u %u) remaining %u\n", old_order, new_order, | 457 | printv(2, "split(%u %u) remaining %u\n", old_order, new_order, |
457 | rtp->nr); | 458 | rtp->nr); |
458 | /* | 459 | /* |
459 | * Can't check for equality here as some nodes may have been | 460 | * Can't check for equality here as some nodes may have been |
@@ -461,7 +462,7 @@ static void check_mem(unsigned old_order, unsigned new_order, unsigned alloc) | |||
461 | * nodes allocated since they should have all been preloaded. | 462 | * nodes allocated since they should have all been preloaded. |
462 | */ | 463 | */ |
463 | if (nr_allocated > alloc) | 464 | if (nr_allocated > alloc) |
464 | printf("split(%u %u) allocated %u %u\n", old_order, new_order, | 465 | printv(2, "split(%u %u) allocated %u %u\n", old_order, new_order, |
465 | alloc, nr_allocated); | 466 | alloc, nr_allocated); |
466 | } | 467 | } |
467 | 468 | ||
diff --git a/tools/testing/radix-tree/regression1.c b/tools/testing/radix-tree/regression1.c index 0d6813a61b37..bf97742fc18c 100644 --- a/tools/testing/radix-tree/regression1.c +++ b/tools/testing/radix-tree/regression1.c | |||
@@ -193,7 +193,7 @@ void regression1_test(void) | |||
193 | long arg; | 193 | long arg; |
194 | 194 | ||
195 | /* Regression #1 */ | 195 | /* Regression #1 */ |
196 | printf("running regression test 1, should finish in under a minute\n"); | 196 | printv(1, "running regression test 1, should finish in under a minute\n"); |
197 | nr_threads = 2; | 197 | nr_threads = 2; |
198 | pthread_barrier_init(&worker_barrier, NULL, nr_threads); | 198 | pthread_barrier_init(&worker_barrier, NULL, nr_threads); |
199 | 199 | ||
@@ -216,5 +216,5 @@ void regression1_test(void) | |||
216 | 216 | ||
217 | free(threads); | 217 | free(threads); |
218 | 218 | ||
219 | printf("regression test 1, done\n"); | 219 | printv(1, "regression test 1, done\n"); |
220 | } | 220 | } |
diff --git a/tools/testing/radix-tree/regression2.c b/tools/testing/radix-tree/regression2.c index a41325d7a170..a24d1beec7c8 100644 --- a/tools/testing/radix-tree/regression2.c +++ b/tools/testing/radix-tree/regression2.c | |||
@@ -80,7 +80,7 @@ void regression2_test(void) | |||
80 | unsigned long int start, end; | 80 | unsigned long int start, end; |
81 | struct page *pages[1]; | 81 | struct page *pages[1]; |
82 | 82 | ||
83 | printf("running regression test 2 (should take milliseconds)\n"); | 83 | printv(1, "running regression test 2 (should take milliseconds)\n"); |
84 | /* 0. */ | 84 | /* 0. */ |
85 | for (i = 0; i <= max_slots - 1; i++) { | 85 | for (i = 0; i <= max_slots - 1; i++) { |
86 | p = page_alloc(); | 86 | p = page_alloc(); |
@@ -116,5 +116,5 @@ void regression2_test(void) | |||
116 | /* We remove all the remained nodes */ | 116 | /* We remove all the remained nodes */ |
117 | radix_tree_delete(&mt_tree, max_slots); | 117 | radix_tree_delete(&mt_tree, max_slots); |
118 | 118 | ||
119 | printf("regression test 2, done\n"); | 119 | printv(1, "regression test 2, done\n"); |
120 | } | 120 | } |
diff --git a/tools/testing/radix-tree/regression3.c b/tools/testing/radix-tree/regression3.c index b594841fae85..670c3d2ae7b1 100644 --- a/tools/testing/radix-tree/regression3.c +++ b/tools/testing/radix-tree/regression3.c | |||
@@ -34,21 +34,21 @@ void regression3_test(void) | |||
34 | void **slot; | 34 | void **slot; |
35 | bool first; | 35 | bool first; |
36 | 36 | ||
37 | printf("running regression test 3 (should take milliseconds)\n"); | 37 | printv(1, "running regression test 3 (should take milliseconds)\n"); |
38 | 38 | ||
39 | radix_tree_insert(&root, 0, ptr0); | 39 | radix_tree_insert(&root, 0, ptr0); |
40 | radix_tree_tag_set(&root, 0, 0); | 40 | radix_tree_tag_set(&root, 0, 0); |
41 | 41 | ||
42 | first = true; | 42 | first = true; |
43 | radix_tree_for_each_tagged(slot, &root, &iter, 0, 0) { | 43 | radix_tree_for_each_tagged(slot, &root, &iter, 0, 0) { |
44 | printf("tagged %ld %p\n", iter.index, *slot); | 44 | printv(2, "tagged %ld %p\n", iter.index, *slot); |
45 | if (first) { | 45 | if (first) { |
46 | radix_tree_insert(&root, 1, ptr); | 46 | radix_tree_insert(&root, 1, ptr); |
47 | radix_tree_tag_set(&root, 1, 0); | 47 | radix_tree_tag_set(&root, 1, 0); |
48 | first = false; | 48 | first = false; |
49 | } | 49 | } |
50 | if (radix_tree_deref_retry(*slot)) { | 50 | if (radix_tree_deref_retry(*slot)) { |
51 | printf("retry at %ld\n", iter.index); | 51 | printv(2, "retry at %ld\n", iter.index); |
52 | slot = radix_tree_iter_retry(&iter); | 52 | slot = radix_tree_iter_retry(&iter); |
53 | continue; | 53 | continue; |
54 | } | 54 | } |
@@ -57,13 +57,13 @@ void regression3_test(void) | |||
57 | 57 | ||
58 | first = true; | 58 | first = true; |
59 | radix_tree_for_each_slot(slot, &root, &iter, 0) { | 59 | radix_tree_for_each_slot(slot, &root, &iter, 0) { |
60 | printf("slot %ld %p\n", iter.index, *slot); | 60 | printv(2, "slot %ld %p\n", iter.index, *slot); |
61 | if (first) { | 61 | if (first) { |
62 | radix_tree_insert(&root, 1, ptr); | 62 | radix_tree_insert(&root, 1, ptr); |
63 | first = false; | 63 | first = false; |
64 | } | 64 | } |
65 | if (radix_tree_deref_retry(*slot)) { | 65 | if (radix_tree_deref_retry(*slot)) { |
66 | printk("retry at %ld\n", iter.index); | 66 | printv(2, "retry at %ld\n", iter.index); |
67 | slot = radix_tree_iter_retry(&iter); | 67 | slot = radix_tree_iter_retry(&iter); |
68 | continue; | 68 | continue; |
69 | } | 69 | } |
@@ -72,30 +72,30 @@ void regression3_test(void) | |||
72 | 72 | ||
73 | first = true; | 73 | first = true; |
74 | radix_tree_for_each_contig(slot, &root, &iter, 0) { | 74 | radix_tree_for_each_contig(slot, &root, &iter, 0) { |
75 | printk("contig %ld %p\n", iter.index, *slot); | 75 | printv(2, "contig %ld %p\n", iter.index, *slot); |
76 | if (first) { | 76 | if (first) { |
77 | radix_tree_insert(&root, 1, ptr); | 77 | radix_tree_insert(&root, 1, ptr); |
78 | first = false; | 78 | first = false; |
79 | } | 79 | } |
80 | if (radix_tree_deref_retry(*slot)) { | 80 | if (radix_tree_deref_retry(*slot)) { |
81 | printk("retry at %ld\n", iter.index); | 81 | printv(2, "retry at %ld\n", iter.index); |
82 | slot = radix_tree_iter_retry(&iter); | 82 | slot = radix_tree_iter_retry(&iter); |
83 | continue; | 83 | continue; |
84 | } | 84 | } |
85 | } | 85 | } |
86 | 86 | ||
87 | radix_tree_for_each_slot(slot, &root, &iter, 0) { | 87 | radix_tree_for_each_slot(slot, &root, &iter, 0) { |
88 | printf("slot %ld %p\n", iter.index, *slot); | 88 | printv(2, "slot %ld %p\n", iter.index, *slot); |
89 | if (!iter.index) { | 89 | if (!iter.index) { |
90 | printf("next at %ld\n", iter.index); | 90 | printv(2, "next at %ld\n", iter.index); |
91 | slot = radix_tree_iter_resume(slot, &iter); | 91 | slot = radix_tree_iter_resume(slot, &iter); |
92 | } | 92 | } |
93 | } | 93 | } |
94 | 94 | ||
95 | radix_tree_for_each_contig(slot, &root, &iter, 0) { | 95 | radix_tree_for_each_contig(slot, &root, &iter, 0) { |
96 | printf("contig %ld %p\n", iter.index, *slot); | 96 | printv(2, "contig %ld %p\n", iter.index, *slot); |
97 | if (!iter.index) { | 97 | if (!iter.index) { |
98 | printf("next at %ld\n", iter.index); | 98 | printv(2, "next at %ld\n", iter.index); |
99 | slot = radix_tree_iter_resume(slot, &iter); | 99 | slot = radix_tree_iter_resume(slot, &iter); |
100 | } | 100 | } |
101 | } | 101 | } |
@@ -103,9 +103,9 @@ void regression3_test(void) | |||
103 | radix_tree_tag_set(&root, 0, 0); | 103 | radix_tree_tag_set(&root, 0, 0); |
104 | radix_tree_tag_set(&root, 1, 0); | 104 | radix_tree_tag_set(&root, 1, 0); |
105 | radix_tree_for_each_tagged(slot, &root, &iter, 0, 0) { | 105 | radix_tree_for_each_tagged(slot, &root, &iter, 0, 0) { |
106 | printf("tagged %ld %p\n", iter.index, *slot); | 106 | printv(2, "tagged %ld %p\n", iter.index, *slot); |
107 | if (!iter.index) { | 107 | if (!iter.index) { |
108 | printf("next at %ld\n", iter.index); | 108 | printv(2, "next at %ld\n", iter.index); |
109 | slot = radix_tree_iter_resume(slot, &iter); | 109 | slot = radix_tree_iter_resume(slot, &iter); |
110 | } | 110 | } |
111 | } | 111 | } |
@@ -113,5 +113,5 @@ void regression3_test(void) | |||
113 | radix_tree_delete(&root, 0); | 113 | radix_tree_delete(&root, 0); |
114 | radix_tree_delete(&root, 1); | 114 | radix_tree_delete(&root, 1); |
115 | 115 | ||
116 | printf("regression test 3 passed\n"); | 116 | printv(1, "regression test 3 passed\n"); |
117 | } | 117 | } |
diff --git a/tools/testing/radix-tree/tag_check.c b/tools/testing/radix-tree/tag_check.c index fd98c132207a..d4ff00989245 100644 --- a/tools/testing/radix-tree/tag_check.c +++ b/tools/testing/radix-tree/tag_check.c | |||
@@ -49,10 +49,10 @@ void simple_checks(void) | |||
49 | } | 49 | } |
50 | verify_tag_consistency(&tree, 0); | 50 | verify_tag_consistency(&tree, 0); |
51 | verify_tag_consistency(&tree, 1); | 51 | verify_tag_consistency(&tree, 1); |
52 | printf("before item_kill_tree: %d allocated\n", nr_allocated); | 52 | printv(2, "before item_kill_tree: %d allocated\n", nr_allocated); |
53 | item_kill_tree(&tree); | 53 | item_kill_tree(&tree); |
54 | rcu_barrier(); | 54 | rcu_barrier(); |
55 | printf("after item_kill_tree: %d allocated\n", nr_allocated); | 55 | printv(2, "after item_kill_tree: %d allocated\n", nr_allocated); |
56 | } | 56 | } |
57 | 57 | ||
58 | /* | 58 | /* |
@@ -257,7 +257,7 @@ static void do_thrash(struct radix_tree_root *tree, char *thrash_state, int tag) | |||
257 | 257 | ||
258 | gang_check(tree, thrash_state, tag); | 258 | gang_check(tree, thrash_state, tag); |
259 | 259 | ||
260 | printf("%d(%d) %d(%d) %d(%d) %d(%d) / " | 260 | printv(2, "%d(%d) %d(%d) %d(%d) %d(%d) / " |
261 | "%d(%d) present, %d(%d) tagged\n", | 261 | "%d(%d) present, %d(%d) tagged\n", |
262 | insert_chunk, nr_inserted, | 262 | insert_chunk, nr_inserted, |
263 | delete_chunk, nr_deleted, | 263 | delete_chunk, nr_deleted, |
@@ -296,13 +296,13 @@ static void __leak_check(void) | |||
296 | { | 296 | { |
297 | RADIX_TREE(tree, GFP_KERNEL); | 297 | RADIX_TREE(tree, GFP_KERNEL); |
298 | 298 | ||
299 | printf("%d: nr_allocated=%d\n", __LINE__, nr_allocated); | 299 | printv(2, "%d: nr_allocated=%d\n", __LINE__, nr_allocated); |
300 | item_insert(&tree, 1000000); | 300 | item_insert(&tree, 1000000); |
301 | printf("%d: nr_allocated=%d\n", __LINE__, nr_allocated); | 301 | printv(2, "%d: nr_allocated=%d\n", __LINE__, nr_allocated); |
302 | item_delete(&tree, 1000000); | 302 | item_delete(&tree, 1000000); |
303 | printf("%d: nr_allocated=%d\n", __LINE__, nr_allocated); | 303 | printv(2, "%d: nr_allocated=%d\n", __LINE__, nr_allocated); |
304 | item_kill_tree(&tree); | 304 | item_kill_tree(&tree); |
305 | printf("%d: nr_allocated=%d\n", __LINE__, nr_allocated); | 305 | printv(2, "%d: nr_allocated=%d\n", __LINE__, nr_allocated); |
306 | } | 306 | } |
307 | 307 | ||
308 | static void single_check(void) | 308 | static void single_check(void) |
@@ -336,15 +336,15 @@ void tag_check(void) | |||
336 | extend_checks(); | 336 | extend_checks(); |
337 | contract_checks(); | 337 | contract_checks(); |
338 | rcu_barrier(); | 338 | rcu_barrier(); |
339 | printf("after extend_checks: %d allocated\n", nr_allocated); | 339 | printv(2, "after extend_checks: %d allocated\n", nr_allocated); |
340 | __leak_check(); | 340 | __leak_check(); |
341 | leak_check(); | 341 | leak_check(); |
342 | rcu_barrier(); | 342 | rcu_barrier(); |
343 | printf("after leak_check: %d allocated\n", nr_allocated); | 343 | printv(2, "after leak_check: %d allocated\n", nr_allocated); |
344 | simple_checks(); | 344 | simple_checks(); |
345 | rcu_barrier(); | 345 | rcu_barrier(); |
346 | printf("after simple_checks: %d allocated\n", nr_allocated); | 346 | printv(2, "after simple_checks: %d allocated\n", nr_allocated); |
347 | thrash_tags(); | 347 | thrash_tags(); |
348 | rcu_barrier(); | 348 | rcu_barrier(); |
349 | printf("after thrash_tags: %d allocated\n", nr_allocated); | 349 | printv(2, "after thrash_tags: %d allocated\n", nr_allocated); |
350 | } | 350 | } |