diff options
author | Matthew Wilcox <mawilcox@microsoft.com> | 2016-12-14 18:08:17 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-12-14 19:04:09 -0500 |
commit | af1c5cca9030f1bb935463ceb8274bfe82719128 (patch) | |
tree | 3752e975891dbb415883e808fd1d5848d7441f5e /tools | |
parent | cfa40bcfd6fed7010b1633bf127ed8571d3b607e (diff) |
radix tree test suite: use rcu_barrier
Calling rcu_barrier() allows all of the rcu-freed memory to be actually
returned to the pool, and allows nr_allocated to return to 0. As well
as allowing diffs between runs to be more useful, it also lets us
pinpoint leaks more effectively.
Link: http://lkml.kernel.org/r/1480369871-5271-44-git-send-email-mawilcox@linuxonhyperv.com
Signed-off-by: Matthew Wilcox <mawilcox@microsoft.com>
Tested-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Cc: Konstantin Khlebnikov <koct9i@gmail.com>
Cc: Ross Zwisler <ross.zwisler@linux.intel.com>
Cc: Matthew Wilcox <mawilcox@microsoft.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/testing/radix-tree/main.c | 12 | ||||
-rw-r--r-- | tools/testing/radix-tree/tag_check.c | 5 |
2 files changed, 15 insertions, 2 deletions
diff --git a/tools/testing/radix-tree/main.c b/tools/testing/radix-tree/main.c index f1d1e3bd9464..76d9c95aa487 100644 --- a/tools/testing/radix-tree/main.c +++ b/tools/testing/radix-tree/main.c | |||
@@ -295,24 +295,31 @@ static void single_thread_tests(bool long_run) | |||
295 | printf("starting single_thread_tests: %d allocated, preempt %d\n", | 295 | printf("starting single_thread_tests: %d allocated, preempt %d\n", |
296 | nr_allocated, preempt_count); | 296 | nr_allocated, preempt_count); |
297 | multiorder_checks(); | 297 | multiorder_checks(); |
298 | rcu_barrier(); | ||
298 | printf("after multiorder_check: %d allocated, preempt %d\n", | 299 | printf("after multiorder_check: %d allocated, preempt %d\n", |
299 | nr_allocated, preempt_count); | 300 | nr_allocated, preempt_count); |
300 | locate_check(); | 301 | locate_check(); |
302 | rcu_barrier(); | ||
301 | printf("after locate_check: %d allocated, preempt %d\n", | 303 | printf("after locate_check: %d allocated, preempt %d\n", |
302 | nr_allocated, preempt_count); | 304 | nr_allocated, preempt_count); |
303 | tag_check(); | 305 | tag_check(); |
306 | rcu_barrier(); | ||
304 | printf("after tag_check: %d allocated, preempt %d\n", | 307 | printf("after tag_check: %d allocated, preempt %d\n", |
305 | nr_allocated, preempt_count); | 308 | nr_allocated, preempt_count); |
306 | gang_check(); | 309 | gang_check(); |
310 | rcu_barrier(); | ||
307 | printf("after gang_check: %d allocated, preempt %d\n", | 311 | printf("after gang_check: %d allocated, preempt %d\n", |
308 | nr_allocated, preempt_count); | 312 | nr_allocated, preempt_count); |
309 | add_and_check(); | 313 | add_and_check(); |
314 | rcu_barrier(); | ||
310 | printf("after add_and_check: %d allocated, preempt %d\n", | 315 | printf("after add_and_check: %d allocated, preempt %d\n", |
311 | nr_allocated, preempt_count); | 316 | nr_allocated, preempt_count); |
312 | dynamic_height_check(); | 317 | dynamic_height_check(); |
318 | rcu_barrier(); | ||
313 | printf("after dynamic_height_check: %d allocated, preempt %d\n", | 319 | printf("after dynamic_height_check: %d allocated, preempt %d\n", |
314 | nr_allocated, preempt_count); | 320 | nr_allocated, preempt_count); |
315 | big_gang_check(long_run); | 321 | big_gang_check(long_run); |
322 | rcu_barrier(); | ||
316 | printf("after big_gang_check: %d allocated, preempt %d\n", | 323 | printf("after big_gang_check: %d allocated, preempt %d\n", |
317 | nr_allocated, preempt_count); | 324 | nr_allocated, preempt_count); |
318 | for (i = 0; i < (long_run ? 2000 : 3); i++) { | 325 | for (i = 0; i < (long_run ? 2000 : 3); i++) { |
@@ -320,6 +327,7 @@ static void single_thread_tests(bool long_run) | |||
320 | printf("%d ", i); | 327 | printf("%d ", i); |
321 | fflush(stdout); | 328 | fflush(stdout); |
322 | } | 329 | } |
330 | rcu_barrier(); | ||
323 | printf("after copy_tag_check: %d allocated, preempt %d\n", | 331 | printf("after copy_tag_check: %d allocated, preempt %d\n", |
324 | nr_allocated, preempt_count); | 332 | nr_allocated, preempt_count); |
325 | } | 333 | } |
@@ -354,8 +362,8 @@ int main(int argc, char **argv) | |||
354 | 362 | ||
355 | benchmark(); | 363 | benchmark(); |
356 | 364 | ||
357 | sleep(1); | 365 | rcu_barrier(); |
358 | printf("after sleep(1): %d allocated, preempt %d\n", | 366 | printf("after rcu_barrier: %d allocated, preempt %d\n", |
359 | nr_allocated, preempt_count); | 367 | nr_allocated, preempt_count); |
360 | rcu_unregister_thread(); | 368 | rcu_unregister_thread(); |
361 | 369 | ||
diff --git a/tools/testing/radix-tree/tag_check.c b/tools/testing/radix-tree/tag_check.c index b0ac05741750..186f6e4914e4 100644 --- a/tools/testing/radix-tree/tag_check.c +++ b/tools/testing/radix-tree/tag_check.c | |||
@@ -51,6 +51,7 @@ void simple_checks(void) | |||
51 | verify_tag_consistency(&tree, 1); | 51 | verify_tag_consistency(&tree, 1); |
52 | printf("before item_kill_tree: %d allocated\n", nr_allocated); | 52 | printf("before item_kill_tree: %d allocated\n", nr_allocated); |
53 | item_kill_tree(&tree); | 53 | item_kill_tree(&tree); |
54 | rcu_barrier(); | ||
54 | printf("after item_kill_tree: %d allocated\n", nr_allocated); | 55 | printf("after item_kill_tree: %d allocated\n", nr_allocated); |
55 | } | 56 | } |
56 | 57 | ||
@@ -331,12 +332,16 @@ void tag_check(void) | |||
331 | single_check(); | 332 | single_check(); |
332 | extend_checks(); | 333 | extend_checks(); |
333 | contract_checks(); | 334 | contract_checks(); |
335 | rcu_barrier(); | ||
334 | printf("after extend_checks: %d allocated\n", nr_allocated); | 336 | printf("after extend_checks: %d allocated\n", nr_allocated); |
335 | __leak_check(); | 337 | __leak_check(); |
336 | leak_check(); | 338 | leak_check(); |
339 | rcu_barrier(); | ||
337 | printf("after leak_check: %d allocated\n", nr_allocated); | 340 | printf("after leak_check: %d allocated\n", nr_allocated); |
338 | simple_checks(); | 341 | simple_checks(); |
342 | rcu_barrier(); | ||
339 | printf("after simple_checks: %d allocated\n", nr_allocated); | 343 | printf("after simple_checks: %d allocated\n", nr_allocated); |
340 | thrash_tags(); | 344 | thrash_tags(); |
345 | rcu_barrier(); | ||
341 | printf("after thrash_tags: %d allocated\n", nr_allocated); | 346 | printf("after thrash_tags: %d allocated\n", nr_allocated); |
342 | } | 347 | } |