From: Alessio Igor Bogani <abogani@kernel.org>
To: Greg KH <greg@kroah.com>, Rusty Russell <rusty@rustcorp.com.au>,
Tim Bird <tim.bird@am.sony.com>,
Christoph Hellwig <hch@infradead.org>
Cc: Anders Kaseorg <andersk@ksplice.com>,
Tim Abbott <tabbott@ksplice.com>,
LKML <linux-kernel@vger.kernel.org>,
Linux Embedded <linux-embedded@vger.kernel.org>,
Jason Wessel <jason.wessel@windriver.com>,
Dirk Behme <dirk.behme@googlemail.com>,
Alessio Igor Bogani <abogani@kernel.org>
Subject:
Date: Wed, 18 May 2011 20:55:25 +0200 [thread overview]
Message-ID: <1305744925-8162-1-git-send-email-abogani@kernel.org> (raw)
In-Reply-To: <4DD305B3.3000707@am.sony.com>
Dear Mr. Bird, Dear Mr. Kroah-Hartman,
Sorry for my very bad English.
2011/5/18 Tim Bird <tim.bird@am.sony.com>:
[...]
> Alessio - do you have any timings you can share for the speedup?
You can find a little benchmark using ftrace at end of this email:
https://lkml.org/lkml/2011/4/5/341
> On 05/17/2011 04:22 PM, Greg KH wrote:
>> On Tue, May 17, 2011 at 10:56:03PM +0200, Alessio Igor Bogani wrote:
>>> This work was supported by a hardware donation from the CE Linux Forum.
[...]
>> Please explain why you make a change, not just who sponsored the change,
>> that's not very interesting to developers.
You are right. I apologize.
This patch is a missing piece (not essential it is only a further little
optimization) of this little patchset:
https://lkml.org/lkml/2011/4/16/48
Unfortunately I forgot to include this patch in the series (my first error)
then I avoided explaining the changes because I had thought that those were
already enough explained in the cover-letter of the patchset (my second error).
Sorry for my mistakes.
Is this better?
Subject: [PATCH] module: Use binary search in lookup_symbol()
The function is_exported() with its helper function lookup_symbol() are used to
verify if a provided symbol is effectively exported by the kernel or by the
modules. Now that both have their symbols sorted we can replace a linear search
with a binary search which provide a considerably speed-up.
This work was supported by a hardware donation from the CE Linux Forum.
Signed-off-by: Alessio Igor Bogani <abogani@kernel.org>
---
kernel/module.c | 7 ++-----
1 files changed, 2 insertions(+), 5 deletions(-)
diff --git a/kernel/module.c b/kernel/module.c
index 1e2b657..795bdc7 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -2055,11 +2055,8 @@ static const struct kernel_symbol *lookup_symbol(const char *name,
const struct kernel_symbol *start,
const struct kernel_symbol *stop)
{
- const struct kernel_symbol *ks = start;
- for (; ks < stop; ks++)
- if (strcmp(ks->name, name) == 0)
- return ks;
- return NULL;
+ return bsearch(name, start, stop - start,
+ sizeof(struct kernel_symbol), cmp_name);
}
static int is_exported(const char *name, unsigned long value,
--
Thank you very much!
Ciao,
Alessio
next prev parent reply other threads:[~2011-05-18 18:55 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-03 20:42 [PATCH] module: Use binary search in lookup_symbol() Alessio Igor Bogani
2011-05-04 15:34 ` Dirk Behme
2011-05-04 17:30 ` Alessio Igor Bogani
2011-05-16 15:36 ` Dirk Behme
2011-05-16 18:02 ` Anders Kaseorg
2011-05-16 20:23 ` Alessio Igor Bogani
2011-05-16 21:01 ` Joe Perches
2011-05-16 21:08 ` Joe Perches
2011-05-17 3:52 ` Rusty Russell
2011-05-17 19:18 ` Dirk Behme
2011-05-17 19:41 ` Alessio Igor Bogani
2011-05-17 20:56 ` Alessio Igor Bogani
2011-05-17 23:22 ` Greg KH
2011-05-17 23:33 ` Tim Bird
2011-05-18 7:54 ` Christoph Hellwig
2011-05-18 17:00 ` Tim Bird
2011-05-18 19:21 ` Greg KH
2011-05-18 21:10 ` module boot time (was Re: [PATCH] module: Use binary search in lookup_symbol()) Tim Bird
2011-05-18 21:34 ` Greg KH
2011-05-19 19:56 ` Jeff Mahoney
2011-05-20 21:29 ` Tim Bird
2011-05-21 14:23 ` Jeff Mahoney
2011-05-18 18:55 ` Alessio Igor Bogani [this message]
2011-05-18 19:22 ` your mail Greg KH
2011-05-18 20:35 ` Alessio Igor Bogani
2011-05-18 20:35 ` [PATCH] module: Use binary search in lookup_symbol() Alessio Igor Bogani
2011-05-18 1:07 ` Rusty Russell
2011-05-18 15:26 ` Dirk Behme
2011-05-19 7:26 ` Rusty Russell
2011-05-18 1:10 ` Rusty Russell
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=1305744925-8162-1-git-send-email-abogani@kernel.org \
--to=abogani@kernel.org \
--cc=andersk@ksplice.com \
--cc=dirk.behme@googlemail.com \
--cc=greg@kroah.com \
--cc=hch@infradead.org \
--cc=jason.wessel@windriver.com \
--cc=linux-embedded@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rusty@rustcorp.com.au \
--cc=tabbott@ksplice.com \
--cc=tim.bird@am.sony.com \
/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 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).