summaryrefslogtreecommitdiff
path: root/tools/testing/radix-tree/main.c
diff options
context:
space:
mode:
authorMatthew Wilcox <mawilcox@microsoft.com>2016-12-15 02:08:17 +0300
committerLinus Torvalds <torvalds@linux-foundation.org>2016-12-15 03:04:09 +0300
commitaf1c5cca9030f1bb935463ceb8274bfe82719128 (patch)
tree3752e975891dbb415883e808fd1d5848d7441f5e /tools/testing/radix-tree/main.c
parentcfa40bcfd6fed7010b1633bf127ed8571d3b607e (diff)
downloadlinux-af1c5cca9030f1bb935463ceb8274bfe82719128.tar.xz
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/testing/radix-tree/main.c')
-rw-r--r--tools/testing/radix-tree/main.c12
1 files changed, 10 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)
printf("starting single_thread_tests: %d allocated, preempt %d\n",
nr_allocated, preempt_count);
multiorder_checks();
+ rcu_barrier();
printf("after multiorder_check: %d allocated, preempt %d\n",
nr_allocated, preempt_count);
locate_check();
+ rcu_barrier();
printf("after locate_check: %d allocated, preempt %d\n",
nr_allocated, preempt_count);
tag_check();
+ rcu_barrier();
printf("after tag_check: %d allocated, preempt %d\n",
nr_allocated, preempt_count);
gang_check();
+ rcu_barrier();
printf("after gang_check: %d allocated, preempt %d\n",
nr_allocated, preempt_count);
add_and_check();
+ rcu_barrier();
printf("after add_and_check: %d allocated, preempt %d\n",
nr_allocated, preempt_count);
dynamic_height_check();
+ rcu_barrier();
printf("after dynamic_height_check: %d allocated, preempt %d\n",
nr_allocated, preempt_count);
big_gang_check(long_run);
+ rcu_barrier();
printf("after big_gang_check: %d allocated, preempt %d\n",
nr_allocated, preempt_count);
for (i = 0; i < (long_run ? 2000 : 3); i++) {
@@ -320,6 +327,7 @@ static void single_thread_tests(bool long_run)
printf("%d ", i);
fflush(stdout);
}
+ rcu_barrier();
printf("after copy_tag_check: %d allocated, preempt %d\n",
nr_allocated, preempt_count);
}
@@ -354,8 +362,8 @@ int main(int argc, char **argv)
benchmark();
- sleep(1);
- printf("after sleep(1): %d allocated, preempt %d\n",
+ rcu_barrier();
+ printf("after rcu_barrier: %d allocated, preempt %d\n",
nr_allocated, preempt_count);
rcu_unregister_thread();