From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S941440AbcKPWaj (ORCPT ); Wed, 16 Nov 2016 17:30:39 -0500 Received: from p3plsmtps2ded01.prod.phx3.secureserver.net ([208.109.80.58]:48092 "EHLO p3plsmtps2ded01.prod.phx3.secureserver.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S936101AbcKPWYF (ORCPT ); Wed, 16 Nov 2016 17:24:05 -0500 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:17:05 -0800 Message-Id: <1479341856-30320-41-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: MS4wfBGzj7szfEWrsrJyWSPt3WE0BzMWXUn9UQzCodZilZ8Rqwo3A8lJel5uM5XSE+QF+RnEYMjC91y5cARd/Pvu+0f7skwUQkdT6m099GclRZu0MXI9HY6w /vzWehVI9cO3T9fTLqLX8ybvMuy5INroc7OBBmK4+bI0xAqPQUJzKsrNfGtnDLxbjb6F3reJfgLj1+Pnn3tvsPDGbtVZAlzEHOQL83CxDxTxXfY8LZD+bG6c /p4leTYmZPYwboACOm2IWWBUfLdfXKUd5mT0fq9ISXhUkUBnhz5jlzrWDNHXjA/7wZPwe6kg8NboLES7ppsQq7OZM1M3h177JxE6izFT5jXAwEqLSlEYuOuj GHwRKMtRgV7j3bpkjxROCLK+RnsK83MUlOkKAqFATqNIMDUbE9RiyXRTSD0fIc8SyMT4IMfnu8CkcI9dIelErFG+ODmOwtro8EkvLNdjfXTCfONH5z8= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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:17:05 -0800 Message-Id: <1479341856-30320-41-git-send-email-mawilcox@linuxonhyperv.com> In-Reply-To: <1479341856-30320-1-git-send-email-mawilcox@linuxonhyperv.com> References: <1479341856-30320-1-git-send-email-mawilcox@linuxonhyperv.com> Sender: owner-linux-mm@kvack.org List-ID: 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 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org