From: Liam R. Howlett Date: Wed, 25 Nov 2020 18:51:56 +0000 (-0500) Subject: test_maple_tree: Add bench_walk() X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=e82c85d9d64f1ef47fb964f8cb47c9492f4de385;p=users%2Fjedix%2Flinux-maple.git test_maple_tree: Add bench_walk() Signed-off-by: Liam R. Howlett --- 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);