Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S938797AbcKPWfV (ORCPT ); Wed, 16 Nov 2016 17:35:21 -0500 Received: from p3plsmtps2ded02.prod.phx3.secureserver.net ([208.109.80.59]:59486 "EHLO p3plsmtps2ded02.prod.phx3.secureserver.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753227AbcKPWfT (ORCPT ); Wed, 16 Nov 2016 17:35:19 -0500 X-Greylist: delayed 676 seconds by postgrey-1.27 at vger.kernel.org; Wed, 16 Nov 2016 17:35:19 EST x-originating-ip: 72.167.245.219 From: Matthew Wilcox To: linux-kernel@vger.kernel.org, Andrew Morton , Konstantin Khlebnikov , Ross Zwisler Cc: linux-fsdevel@vger.kernel.org, Matthew Wilcox , linux-mm@kvack.org, "Kirill A . Shutemov" Subject: [PATCH 04/29] radix tree test suite: Free preallocated nodes Date: Wed, 16 Nov 2016 16:16:29 -0800 Message-Id: <1479341856-30320-5-git-send-email-mawilcox@linuxonhyperv.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1479341856-30320-1-git-send-email-mawilcox@linuxonhyperv.com> References: <1479341856-30320-1-git-send-email-mawilcox@linuxonhyperv.com> X-CMAE-Envelope: MS4wfN5dirGDICzoAMJduhH4atYXu2tKacjh+zgSlXIEvMUixAqLqW255noZQ6To/hlcd8eDcmbcm7BsTqYABH/5T2BAOhs6hPAQdzFMaccYAsy352FAhFso XNi4Z6rPtN79vdWnw6Yfx0vfDun+TQPJUtTH5e8GGDQ+LGNsDvZY0978axTx/IivJHUPCJvYJ7RXbUBi0r5zWBVhceu6tnEJpGnEZwlTwmRyIuMwngyAvGPi 8OQrrtijIMUDYH0pox63xoS7bTAyEhfRqFBvmnvBYaJYsuJQig/KiqjD/89gxi/VepQb6IJl8EYH1KuTBAuKhfG5U2uAvJDumfJuEpRwBbbmi+J/6Qs02kUQ 7L3F0QJHi6bAFW4QkyB+kaPM7t8krBnay0Lmgw5G8zjh3jrzYT40jk94j1XpoiIXXVQeke+rDIkIKtNUUaYPDoDRPVI9SnDmkWf1+jQ29qDgiMWTty8= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1763 Lines: 49 From: Matthew Wilcox It can be a source of mild concern when the test suite shows that we're leaking nodes. While poring over the source code looking for leaks can lead to some fascinating bugs being discovered, sometimes the leak is simply that these nodes were preallocated and are sitting on the per-CPU list. Free them by faking a CPU_DEAD event. Signed-off-by: Matthew Wilcox --- tools/testing/radix-tree/main.c | 3 +++ tools/testing/radix-tree/test.h | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/tools/testing/radix-tree/main.c b/tools/testing/radix-tree/main.c index 64ffe67..2930560 100644 --- a/tools/testing/radix-tree/main.c +++ b/tools/testing/radix-tree/main.c @@ -344,6 +344,9 @@ int main(int argc, char **argv) iteration_test(); single_thread_tests(long_run); + /* Free any remaining preallocated nodes */ + radix_tree_callback(NULL, CPU_DEAD, NULL); + sleep(1); printf("after sleep(1): %d allocated, preempt %d\n", nr_allocated, preempt_count); diff --git a/tools/testing/radix-tree/test.h b/tools/testing/radix-tree/test.h index 217fb24..8cd666a 100644 --- a/tools/testing/radix-tree/test.h +++ b/tools/testing/radix-tree/test.h @@ -2,6 +2,8 @@ #include #include #include +#include +#include struct item { unsigned long index; @@ -44,3 +46,5 @@ void radix_tree_dump(struct radix_tree_root *root); int root_tag_get(struct radix_tree_root *root, unsigned int tag); unsigned long node_maxindex(struct radix_tree_node *); unsigned long shift_maxindex(unsigned int shift); +int radix_tree_callback(struct notifier_block *nfb, + unsigned long action, void *hcpu); -- 2.10.2