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 <mawilcox@microsoft.com>
This commit is contained in:
Matthew Wilcox
2016-12-24 07:49:18 -05:00
parent d3e709e63e
commit 5eeb2d23df
2 changed files with 26 additions and 0 deletions

View File

@@ -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 */