}
-static noinline void check_node_store(struct maple_tree *mt)
+
+static noinline void bench_node_store(struct maple_tree *mt)
{
int i, overwrite = 76, max = 240, count = 20000000;
overwrite = 76;
}
}
+
static noinline void check_forking(struct maple_tree *mt)
+{
+
+ struct maple_tree newmt;
+ int i, max = 3000;
+ void *val;
+ MA_STATE(mas, mt, 0, 0);
+ MA_STATE(newmas, mt, 0, 0);
+
+ for (i = 0; i < max; i+=10)
+ mtree_store_range(mt, i, i + 5, xa_mk_value(i), GFP_KERNEL);
+
+ mt_set_non_kernel(99999);
+ mtree_init(&newmt, MAPLE_ALLOC_RANGE);
+ newmas.tree = &newmt;
+ mas_reset(&newmas);
+ mas_reset(&mas);
+ mas.index = 0;
+ mas.last = 0;
+ if (mas_entry_count(&newmas, max/10)) {
+ printk("OOM!");
+ BUG_ON(1);
+ }
+
+ mas_for_each(&mas, val, ULONG_MAX) {
+ newmas.index = mas.index;
+ newmas.last = mas.last;
+ mas_store(&newmas, val);
+ }
+ mas_empty_alloc(&newmas);
+ mt_validate(&newmt);
+ mas_reset(&mas);
+ mas_reset(&newmas);
+ mas_for_each(&mas, val, ULONG_MAX) {
+ void *val2 = mas_find(&newmas, mas.last);
+ MT_BUG_ON(&newmt, mas.index != newmas.index);
+ MT_BUG_ON(&newmt, mas.last != newmas.last);
+ MT_BUG_ON(&newmt, val != val2);
+ }
+ mt_set_non_kernel(0);
+ mtree_destroy(&newmt);
+}
+
+static noinline void bench_forking(struct maple_tree *mt)
{
struct maple_tree newmt;
pr_info("\nTEST STARTING\n\n");
#if 0
mtree_init(&tree, MAPLE_ALLOC_RANGE);
- check_node_store(&tree);
+ bench_node_store(&tree);
mtree_destroy(&tree);
goto skip;
#endif
#if 0
mtree_init(&tree, MAPLE_ALLOC_RANGE);
- check_forking(&tree);
+ bench_forking(&tree);
mtree_destroy(&tree);
goto skip;
#endif
check_dfs_preorder(&tree);
mtree_destroy(&tree);
+ mtree_init(&tree, MAPLE_ALLOC_RANGE);
+ check_forking(&tree);
+ mtree_destroy(&tree);
+
/* Test ranges (store and insert) */
mtree_init(&tree, 0);
check_ranges(&tree);