Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1631371

Re: [PATCH] kallsyms: optimize kallsyms_lookup_name() for a few cases

From Michael Ellerman <mpe@ellerman.id.au>
Newsgroups linux.kernel
Subject Re: [PATCH] kallsyms: optimize kallsyms_lookup_name() for a few cases
Date 2017-04-26 12:50 +0200
Message-ID <tAsGe-15h-11@gated-at.bofh.it> (permalink)
References <tAbm2-70X-23@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


"Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com> writes:
> diff --git a/kernel/kallsyms.c b/kernel/kallsyms.c
> index 6a3b249a2ae1..d134b060564f 100644
> --- a/kernel/kallsyms.c
> +++ b/kernel/kallsyms.c
> @@ -205,6 +205,12 @@ unsigned long kallsyms_lookup_name(const char *name)
>  	unsigned long i;
>  	unsigned int off;
>  
> +	if (!name || *name == '\0')
> +		return false;
> +
> +	if (strnchr(name, MODULE_NAME_LEN, ':'))
> +		return module_kallsyms_lookup_name(name);
> +
>  	for (i = 0, off = 0; i < kallsyms_num_syms; i++) {
>  		off = kallsyms_expand_symbol(off, namebuf, ARRAY_SIZE(namebuf));
	...				
	}
       	return module_kallsyms_lookup_name(name);

Is the rest of the context.

Which looks a bit odd, we already did module lookup previously?

But it's correct, because you can lookup a symbol in a module without a
module prefix, it just looks in every module.

You could invert the logic, ie. check that there isn't a ":" in the name
and only in that case do the for loop, always falling back to module
lookup.

Or just add a comment explaining why we call module lookup in two places.

cheers

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] kallsyms: optimize kallsyms_lookup_name() for a few cases "Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com> - 2017-04-25 18:20 +0200
  RE: [PATCH] kallsyms: optimize kallsyms_lookup_name() for a few  cases David Laight <David.Laight@ACULAB.COM> - 2017-04-25 18:40 +0200
    RE: [PATCH] kallsyms: optimize kallsyms_lookup_name() for a few cases "Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com> - 2017-04-25 19:20 +0200
  Re: [PATCH] kallsyms: optimize kallsyms_lookup_name() for a few cases Michael Ellerman <mpe@ellerman.id.au> - 2017-04-26 12:50 +0200
    Re: [PATCH] kallsyms: optimize kallsyms_lookup_name() for a few cases "Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com> - 2017-04-26 22:10 +0200
      Re: [PATCH] kallsyms: optimize kallsyms_lookup_name() for a few  cases Masami Hiramatsu <mhiramat@kernel.org> - 2017-04-27 04:30 +0200

csiph-web