All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michal Marek <mmarek@suse.cz>
To: Cheng Renquan <crquan@gmail.com>
Cc: linux-kbuild@vger.kernel.org, lkml <linux-kernel@vger.kernel.org>,
	Rusty Russell <rusty@rustcorp.com.au>
Subject: Re: [PATCH] kallsyms: skip kernel symbols when lookup in module
Date: Thu, 07 Jan 2010 12:40:42 +0100	[thread overview]
Message-ID: <4B45C83A.9000803@suse.cz> (raw)
In-Reply-To: <1262846626-27109-1-git-send-email-crquan@gmail.com>

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

      reply	other threads:[~2010-01-07 11:40 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-07  6:43 [PATCH] kallsyms: skip kernel symbols when lookup in module Cheng Renquan
2010-01-07 11:40 ` Michal Marek [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4B45C83A.9000803@suse.cz \
    --to=mmarek@suse.cz \
    --cc=crquan@gmail.com \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rusty@rustcorp.com.au \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.