public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Alessio Igor Bogani <abogani@kernel.org>
To: Rusty Russell <rusty@rustcorp.com.au>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Ian Lance Taylor <ian@airs.com>, Tim Bird <tim.bird@am.sony.com>,
	Alessio Igor Bogani <abogani@kernel.org>
Subject: [PATCH 0/2] Speed up the symbols' resolution process
Date: Wed, 23 Mar 2011 22:00:41 +0100	[thread overview]
Message-ID: <1300914043-2297-1-git-send-email-abogani@kernel.org> (raw)

The intent of this patchset is to speed up the symbols' resolution process.

This objective is achieved by sorting all symbols (those which reside both in
the kernel and in the modules) and thus convert the slow linear search to the
fast binary search.

To avoid adding lots of code for symbols sorting I rely on the linker which can
easily do the job thanks to a little trick. The trick isn't really beautiful to
see but permits minimal changes to the code and build process. Indeed, the
patchset is constituted by only two very short patches.

In the first patch I changed the code for place every symbol in a different
section (for example: "___ksymtab" sec "__" #sym) at compile time (this the
above mentioned trick!). In the same patch I also request to the linker to
sort and merge all these sections into the appropriate ones (for example:
"__ksymtab") at link time using the linker scripts. Once all symbols are
sorted we can use binary search instead of the linear one (this is done in
the second patch).

I'm fairly sure that this is a good speed improvement even though I haven't
made any benchmarking (I would be very happy to receive suggestions about how
made it). Collaterally, the boot time should be reduced also (proportionally
to the number of modules involved at boot stage).

I hope that you find that interesting!


This work was supported by a hardware donation from the CE Linux Forum.


Alessio Igor Bogani (2):
  Let Linker sort the symbols
  Replace the linear search with a binary search for locate the symbols

 include/asm-generic/vmlinux.lds.h |   20 +++++++-------
 include/linux/module.h            |    4 +-
 kernel/module.c                   |   49 ++++++++++++++++++++++--------------
 scripts/module-common.lds         |   19 ++++++++++++++
 4 files changed, 61 insertions(+), 31 deletions(-)

-- 
1.7.4.1


             reply	other threads:[~2011-03-23 21:02 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-23 21:00 Alessio Igor Bogani [this message]
2011-03-23 21:00 ` [PATCH 1/2] Let Linker sort the symbols Alessio Igor Bogani
2011-03-23 21:00 ` [PATCH 2/2] Replace the linear search with a binary search for locate " Alessio Igor Bogani
2011-03-24 15:54   ` Andi Kleen
2011-03-25  5:14     ` Rusty Russell
2011-03-25 15:41       ` Andi Kleen
2011-03-25 16:30         ` Alessio Igor Bogani
2011-03-25 19:49           ` Andi Kleen
2011-03-25 21:31             ` Alessio Igor Bogani
2011-03-26 20:04               ` Andi Kleen
2011-03-28  8:22                 ` Alessio Igor Bogani
2011-03-28 15:59                   ` Andi Kleen

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=1300914043-2297-1-git-send-email-abogani@kernel.org \
    --to=abogani@kernel.org \
    --cc=ian@airs.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rusty@rustcorp.com.au \
    --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