Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933226AbcK1UHW (ORCPT ); Mon, 28 Nov 2016 15:07:22 -0500 Received: from p3plsmtps2ded02.prod.phx3.secureserver.net ([208.109.80.59]:52502 "EHLO p3plsmtps2ded02.prod.phx3.secureserver.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754980AbcK1T4o (ORCPT ); Mon, 28 Nov 2016 14:56:44 -0500 x-originating-ip: 72.167.245.219 From: Matthew Wilcox To: linux-kernel@vger.kernel.org, Andrew Morton , Konstantin Khlebnikov , Ross Zwisler Cc: Matthew Wilcox , linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, "Kirill A . Shutemov" Subject: [PATCH v3 09/33] radix tree test suite: Use rcu_barrier Date: Mon, 28 Nov 2016 13:50:47 -0800 Message-Id: <1480369871-5271-44-git-send-email-mawilcox@linuxonhyperv.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1480369871-5271-1-git-send-email-mawilcox@linuxonhyperv.com> References: <1480369871-5271-1-git-send-email-mawilcox@linuxonhyperv.com> X-CMAE-Envelope: MS4wfEPIPgdpaMk+7QtiVYs958MhPLzdk5g5DBPz5ldnhDJLByU08okGG1+6880unHSUoeP2iocuDGM+V9od1Jlkr+SdUuaGwd6G4fPpmSTLYNo9cXmLR5rM UQSXRcojYWpDfJ7YmgwSKEw0xEuCo5mx/Qylmj2MeOlmCicaucerDOWuGZSwz4L5K5zzJ1lIwPVuGBddnTutgBR/lPbto7I6IlWtkqMx4hzKXyFaSBU+croC GPF14/IIZw1TMx2m7wycPnTc7em4V08PrdOD77T0reB8LDfQ/IyfKPMO/lFBIdh8+H40YSeLrA96wfrrA6ku5EOldnIdTyCmWhjqS7/CrbaovC77g0PFzSlj 4bHwHs5LxExpLMw6D+7ri+Swi4cJTA9Oc2Ka14haVcJUYHtvpLvlbBLG1BAySnBJQCawi27+kHw1h/RJqIaMZd5A1G83Ruo6wx2vHhPVdCQknBhXcD0= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3288 Lines: 99 From: Matthew Wilcox 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. Signed-off-by: Matthew Wilcox --- tools/testing/radix-tree/main.c | 12 ++++++++++-- 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 f1d1e3b..76d9c95 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(); diff --git a/tools/testing/radix-tree/tag_check.c b/tools/testing/radix-tree/tag_check.c index b0ac057..186f6e4 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) verify_tag_consistency(&tree, 1); printf("before item_kill_tree: %d allocated\n", nr_allocated); item_kill_tree(&tree); + rcu_barrier(); printf("after item_kill_tree: %d allocated\n", nr_allocated); } @@ -331,12 +332,16 @@ void tag_check(void) single_check(); extend_checks(); contract_checks(); + rcu_barrier(); printf("after extend_checks: %d allocated\n", nr_allocated); __leak_check(); leak_check(); + rcu_barrier(); printf("after leak_check: %d allocated\n", nr_allocated); simple_checks(); + rcu_barrier(); printf("after simple_checks: %d allocated\n", nr_allocated); thrash_tags(); + rcu_barrier(); printf("after thrash_tags: %d allocated\n", nr_allocated); } -- 2.10.2