linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH] kallsyms: skip kernel symbols when lookup in module
       [not found] <1262846626-27109-1-git-send-email-crquan@gmail.com>
@ 2010-01-07 11:40 ` Michal Marek
  0 siblings, 0 replies; only message in thread
From: Michal Marek @ 2010-01-07 11:40 UTC (permalink / raw)
  To: Cheng Renquan; +Cc: linux-kbuild, lkml, Rusty Russell

On 7.1.2010 07:43, Cheng Renquan wrote:
> kernel symbols lookup is expensive, when we know it's a lookup in module,
> we can skip the heavy kernel symbols.
> 
> Signed-off-by: Cheng Renquan <crquan@gmail.com>
> ---
>  kernel/kallsyms.c |   12 ++++++++----
>  1 files changed, 8 insertions(+), 4 deletions(-)
> 
> diff --git a/kernel/kallsyms.c b/kernel/kallsyms.c
> index 8e5288a..bb9fdc5 100644
> --- a/kernel/kallsyms.c
> +++ b/kernel/kallsyms.c
> @@ -173,12 +173,16 @@ unsigned long kallsyms_lookup_name(const char *name)
>  	unsigned long i;
>  	unsigned int off;
>  
> -	for (i = 0, off = 0; i < kallsyms_num_syms; i++) {
> -		off = kallsyms_expand_symbol(off, namebuf);
> +	/* if a colon ':' found, skip the heavy kernel symbols */
> +	if (strchr(name, ':') == NULL) {
> +		for (i = 0, off = 0; i < kallsyms_num_syms; i++) {
> +			off = kallsyms_expand_symbol(off, namebuf);
>  
> -		if (strcmp(namebuf, name) == 0)
> -			return kallsyms_addresses[i];
> +			if (strcmp(namebuf, name) == 0)
> +				return kallsyms_addresses[i];
> +		}
>  	}
> +
>  	return module_kallsyms_lookup_name(name);
>  }
>  EXPORT_SYMBOL_GPL(kallsyms_lookup_name);

It think Rusty is the right person to handle this (CC added). But if you
want my opinion: The patch looks ok.

Acked-by: Michal Marek <mmarek@suse.cz>

Michal

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2010-01-07 11:40 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <1262846626-27109-1-git-send-email-crquan@gmail.com>
2010-01-07 11:40 ` [PATCH] kallsyms: skip kernel symbols when lookup in module Michal Marek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).