From 5eeb2d23df29212f901a36dabf16f93d8bd50814 Mon Sep 17 00:00:00 2001 From: Matthew Wilcox Date: Sat, 24 Dec 2016 07:49:18 -0500 Subject: radix tree test suite: Introduce kmalloc_verbose To help track down where memory leaks may be, add the ability to turn on/off printing allocations, frees and delayed frees. Signed-off-by: Matthew Wilcox --- tools/testing/radix-tree/linux/radix-tree.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'tools/testing/radix-tree/linux/radix-tree.h') diff --git a/tools/testing/radix-tree/linux/radix-tree.h b/tools/testing/radix-tree/linux/radix-tree.h index ce694ddd4aea..f4d8532e1bef 100644 --- a/tools/testing/radix-tree/linux/radix-tree.h +++ b/tools/testing/radix-tree/linux/radix-tree.h @@ -1 +1,18 @@ +#ifndef _TEST_RADIX_TREE_H +#define _TEST_RADIX_TREE_H #include "../../../../include/linux/radix-tree.h" + +extern int kmalloc_verbose; + +static inline void trace_call_rcu(struct rcu_head *head, + void (*func)(struct rcu_head *head)) +{ + if (kmalloc_verbose) + printf("Delaying free of %p to slab\n", (char *)head - + offsetof(struct radix_tree_node, rcu_head)); + call_rcu(head, func); +} +#undef call_rcu +#define call_rcu(x, y) trace_call_rcu(x, y) + +#endif /* _TEST_RADIX_TREE_H */ -- cgit v1.2.1 From 73bc029b76482260a144219786d19951f561716e Mon Sep 17 00:00:00 2001 From: Rehas Sachdeva Date: Wed, 4 Jan 2017 11:55:00 -0500 Subject: radix tree test suite: Dial down verbosity with -v Make the output of radix tree test suite less verbose by default and add -v and -vv command line options for increasing level of verbosity. Signed-off-by: Rehas Sachdeva Signed-off-by: Matthew Wilcox --- tools/testing/radix-tree/linux/radix-tree.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'tools/testing/radix-tree/linux/radix-tree.h') diff --git a/tools/testing/radix-tree/linux/radix-tree.h b/tools/testing/radix-tree/linux/radix-tree.h index f4d8532e1bef..ddd135fa3af7 100644 --- a/tools/testing/radix-tree/linux/radix-tree.h +++ b/tools/testing/radix-tree/linux/radix-tree.h @@ -3,6 +3,7 @@ #include "../../../../include/linux/radix-tree.h" extern int kmalloc_verbose; +extern int test_verbose; static inline void trace_call_rcu(struct rcu_head *head, void (*func)(struct rcu_head *head)) @@ -12,6 +13,11 @@ static inline void trace_call_rcu(struct rcu_head *head, offsetof(struct radix_tree_node, rcu_head)); call_rcu(head, func); } + +#define printv(verbosity_level, fmt, ...) \ + if(test_verbose >= verbosity_level) \ + printf(fmt, ##__VA_ARGS__) + #undef call_rcu #define call_rcu(x, y) trace_call_rcu(x, y) -- cgit v1.2.1 From c6ce3e2fe3dacda5e8afb0036c814ae9c3fee9b9 Mon Sep 17 00:00:00 2001 From: Rehas Sachdeva Date: Mon, 13 Feb 2017 16:16:03 -0500 Subject: radix tree test suite: Add config option for map shift Add config option "SHIFT=" to Makefile for building test suite with any value of RADIX_TREE_MAP_SHIFT between 3 and 7 inclusive. Signed-off-by: Rehas Sachdeva [mawilcox@microsoft.com: .gitignore, quieten grep, remove on clean] Signed-off-by: Matthew Wilcox --- tools/testing/radix-tree/linux/radix-tree.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'tools/testing/radix-tree/linux/radix-tree.h') diff --git a/tools/testing/radix-tree/linux/radix-tree.h b/tools/testing/radix-tree/linux/radix-tree.h index ddd135fa3af7..bf1bb231f9b5 100644 --- a/tools/testing/radix-tree/linux/radix-tree.h +++ b/tools/testing/radix-tree/linux/radix-tree.h @@ -1,5 +1,7 @@ #ifndef _TEST_RADIX_TREE_H #define _TEST_RADIX_TREE_H + +#include "generated/map-shift.h" #include "../../../../include/linux/radix-tree.h" extern int kmalloc_verbose; -- cgit v1.2.1