From e82c85d9d64f1ef47fb964f8cb47c9492f4de385 Mon Sep 17 00:00:00 2001 From: "Liam R. Howlett" Date: Wed, 25 Nov 2020 13:51:56 -0500 Subject: [PATCH] test_maple_tree: Add bench_walk() Signed-off-by: Liam R. Howlett --- lib/test_maple_tree.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/lib/test_maple_tree.c b/lib/test_maple_tree.c index 36a3cf7b3acf..0e8e995ac048 100644 --- a/lib/test_maple_tree.c +++ b/lib/test_maple_tree.c @@ -12,6 +12,7 @@ #define CONFIG_DEBUG_MAPLE_TREE //#define BENCH_SLOT_STORE //#define BENCH_NODE_STORE +#define BENCH_WALK //#define BENCH_FORK static int mtree_insert_index(struct maple_tree *mt, unsigned long index, gfp_t gfp) @@ -35317,6 +35318,23 @@ static noinline void bench_node_store(struct maple_tree *mt) } #endif +#if defined(BENCH_WALK) +static noinline void bench_walk(struct maple_tree *mt) +{ + int i, max = 2500, count = 100000000; + MA_STATE(mas, mt, 22, 22); + + for (i = 0; i < max; i += 10) + mtree_store_range(mt, i, i + 5, xa_mk_value(i), GFP_KERNEL); + + for (i = 0; i < count; i++) { + mas_walk(&mas); + mas_reset(&mas); + } + +} +#endif + static noinline void check_forking(struct maple_tree *mt) { @@ -35415,6 +35433,13 @@ static int maple_tree_seed(void) mtree_destroy(&tree); goto skip; #endif +#if defined(BENCH_WALK) +#define BENCH + mtree_init(&tree, MAPLE_ALLOC_RANGE); + bench_walk(&tree); + mtree_destroy(&tree); + goto skip; +#endif #if defined(BENCH_FORK) #define BENCH mtree_init(&tree, MAPLE_ALLOC_RANGE); -- 2.50.1