The patch titled Subject: lib/interval_tree_test.c: allow users to limit scope of endpoint has been added to the -mm tree. Its filename is lib-interval_tree_test-allow-users-to-limit-scope-of-endpoint.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/lib-interval_tree_test-allow-users-to-limit-scope-of-endpoint.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/lib-interval_tree_test-allow-users-to-limit-scope-of-endpoint.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/SubmitChecklist when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Davidlohr Bueso <dave@xxxxxxxxxxxx> Subject: lib/interval_tree_test.c: allow users to limit scope of endpoint Add a 'max_endpoint' parameter such that users may easily limit the size of the intervals that are randomly generated. Link: http://lkml.kernel.org/r/20170518174936.20265-4-dave@xxxxxxxxxxxx Signed-off-by: Davidlohr Bueso <dbueso@xxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- lib/interval_tree_test.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff -puN lib/interval_tree_test.c~lib-interval_tree_test-allow-users-to-limit-scope-of-endpoint lib/interval_tree_test.c --- a/lib/interval_tree_test.c~lib-interval_tree_test-allow-users-to-limit-scope-of-endpoint +++ a/lib/interval_tree_test.c @@ -16,6 +16,7 @@ __param(int, perf_loops, 100000, "Number __param(int, nsearches, 100, "Number of searches to the interval tree"); __param(int, search_loops, 10000, "Number of iterations searching the tree"); +__param(uint, max_endpoint, ~0, "Largest value for the interval's endpoint"); static struct rb_root root = RB_ROOT; static struct interval_tree_node *nodes = NULL; @@ -40,18 +41,20 @@ static void init(void) int i; for (i = 0; i < nnodes; i++) { - u32 a = prandom_u32_state(&rnd); - u32 b = prandom_u32_state(&rnd); - if (a <= b) { - nodes[i].start = a; - nodes[i].last = b; - } else { - nodes[i].start = b; - nodes[i].last = a; - } + u32 b = (prandom_u32_state(&rnd) >> 4) % max_endpoint; + u32 a = (prandom_u32_state(&rnd) >> 4) % b; + + nodes[i].start = a; + nodes[i].last = b; } + + /* + * Limit the search scope to what the user defined. + * Otherwise we are merely measuring empty walks, + * which is pointless. + */ for (i = 0; i < nsearches; i++) - queries[i] = prandom_u32_state(&rnd); + queries[i] = (prandom_u32_state(&rnd) >> 4) % max_endpoint; } static int interval_tree_test_init(void) _ Patches currently in -mm which might be from dave@xxxxxxxxxxxx are lib-interval_tree_test-allow-the-module-to-be-compiled-in.patch lib-interval_tree_test-make-test-options-module-parameters.patch lib-interval_tree_test-allow-users-to-limit-scope-of-endpoint.patch lib-interval_tree_test-allow-full-tree-search.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html