radix tree test suite: free preallocated nodes
authorMatthew Wilcox <willy@infradead.org>
Wed, 14 Dec 2016 23:08:05 +0000 (15:08 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 15 Dec 2016 00:04:09 +0000 (16:04 -0800)
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 calling the CPU dead callback.

Link: http://lkml.kernel.org/r/1480369871-5271-40-git-send-email-mawilcox@linuxonhyperv.com
Signed-off-by: Matthew Wilcox <willy@infradead.org>
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>

index 64ffe67605d46b48c97a6718bf2ddbdb35164aec..52ce1eab0fd37dbd014f98ecef59f88d70aaa549 100644 (file)
@@ -344,6 +344,9 @@ int main(int argc, char **argv)
+       /* Free any remaining preallocated nodes */
+       radix_tree_cpu_dead(0);
        printf("after sleep(1): %d allocated, preempt %d\n",
                nr_allocated, preempt_count);
index 217fb2403f0901c13d55936fa7cfe0c6c9da4157..5d2fad05b263cc28b95cb3a53b12a1a68ca9cca1 100644 (file)
@@ -44,3 +44,4 @@ 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_cpu_dead(unsigned int cpu);