Re: [RFC][PATCH] module: Optimize __module_address() using a latched RB-tree

From: Ingo Molnar
Date: Thu Feb 26 2015 - 07:00:49 EST



* Peter Zijlstra <peterz@xxxxxxxxxxxxx> wrote:

> +static struct module *mod_tree_find(unsigned long addr)
> +{
> + struct module *m;
> + unsigned int seq;
> +
> + do {
> + seq = raw_read_seqcount(&mod_tree.seq);
> + m = __tree_find(&mod_tree.tree[seq & 1], addr);
> + } while (read_seqcount_retry(&mod_tree.seq, seq));
> +
> + return m;
> +}

Btw., if your approach works out fine I bet we could add
one more optimization as well: a PER_CPU(last_module_found)
front cache would help as well, as usually there's quite a
bit of repetition between addresses being looked up and the
resulting modules.

Thanks,

Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/