Re: [PATCH 09/10] module: speed up find_symbol() using binary search on the builtin symbol tables

From: Rusty Russell
Date: Wed Nov 04 2009 - 03:31:40 EST


On Tue, 3 Nov 2009 08:36:21 pm Alan Jenkins wrote:
> + for (type = 0; type < EXPORT_TYPE_MAX; type++) {
> + sym = bsearch(name, ksymtab[type].syms, ksymtab[type].num_syms,
> + sizeof(struct kernel_symbol), symbol_compare);

One minor point: Prefer ARRAY_SIZE() here to EXPORT_TYPE_MAX.

It'd be cool if bsearch was typesafe, but that would freak out the Old School
kernel hackers :)

> + for (type = 0; type < EXPORT_TYPE_MAX; type++) {
> + for (i = 0; i < symtab[type].num_syms; i++) {
> + sym = &symtab[type].syms[i];

Same.

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/