Re: [PATCH V2 2/2] module: Fix performance regression on modules with large symbol tables

From: Rusty Russell
Date: Tue Nov 15 2011 - 21:33:18 EST


On Mon, 14 Nov 2011 08:48:52 +0000, "Jan Beulich" <JBeulich@xxxxxxxx> wrote:
> > + name = &mod->strtab[src->st_name];
> > + if (unlikely(!test_bit(src->st_name, info->strmap))) {
> > + /* Symbol name has already been copied; find it. */
> > + char *dup;
> > +
> > + for (dup = mod->core_strtab; strcmp(dup, name); dup++)
> > + BUG_ON(dup > s);
>
> Aren't you concerned that this again will be rather slow? It would be
> pretty easy to accelerate by comparing only with the tail of each string
> (as nothing else can possibly match), moving from string to string instead
> of from character to character.

Kevin's central thesis is that this is actually really unusual.

I'm not sure how much faster a tail search would be in practice. We're
still scanning the string. Perhaps a "dup[0] == name[0] &&" would
optimize it almost as well, if gcc doesn't already?

Kevin, you're probably in an optimal position to get numbers on this?

Thanks,
Rusty.
--
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/