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

Ingo Molnar
2015-02-26T12:00:45Z

* Peter Zijlstra <peterz@infradead.org> 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