linux-embedded.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alessio Igor Bogani <abogani@kernel.org>
To: Rusty Russell <rusty@rustcorp.com.au>,
	Tim Abbott <tabbott@ksplice.com>,
	Anders Kaseorg <andersk@ksplice.com>,
	Jason Wessel <jason.wessel@windriver.com>,
	Tim Bird <tim.bird@am.sony.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Linux Embedded <linux-embedded@vger.kernel.org>,
	Alessio Igor Bogani <abogani@kernel.org>
Subject: [PATCH 0/4] Speed up the symbols' resolution process V4
Date: Sat, 16 Apr 2011 15:26:09 +0200	[thread overview]
Message-ID: <1302960373-5309-1-git-send-email-abogani@kernel.org> (raw)

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

This objective is achieved by sorting all ksymtab* and kcrctab* symbols
(those which reside both in the kernel and in the modules) and thus use 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 patch
is very simple and short.

In the first place 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!). Thus I 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.

I'm fairly sure that this is a good speed improvement even though I haven't
made any comprehensive benchmarking (but follow a simple one). In any case
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
and symbols nvolved at boot stage).

I hope that you find that interesting!

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

Thanks to Ian Lance Taylor for help about how the linker works.


Changes since V3:
*) Please ignore this version completely

Changes since V2:
*) Fix a bug in each_symbol() semantics by Anders Kaseorg
*) Split the work in three patches as requested by Rusty Russell
*) Add a generic binary search implementation made by Tim Abbott
*) Remove CONFIG_SYMBOLS_BSEARCH kernel option

Changes since V1:
*) Merge all patches into only one
*) Remove few useless things
*) Introduce CONFIG_SYMBOLS_BSEARCH kernel option


Alessio Igor Bogani (3):
  module: Restructure each_symbol() code
  module: Sort exported symbols
  module: Use the binary search for symbols resolution

Tim Abbott (1):
  lib: Add generic binary search function to the kernel.

 include/asm-generic/vmlinux.lds.h |   20 ++++----
 include/linux/bsearch.h           |    9 ++++
 include/linux/module.h            |    4 +-
 kernel/module.c                   |   84 ++++++++++++++++++++++++++++---------
 lib/Makefile                      |    3 +-
 lib/bsearch.c                     |   53 +++++++++++++++++++++++
 scripts/module-common.lds         |   11 +++++
 7 files changed, 151 insertions(+), 33 deletions(-)
 create mode 100644 include/linux/bsearch.h
 create mode 100644 lib/bsearch.c

-- 
1.7.4.1

             reply	other threads:[~2011-04-16 13:26 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-16 13:26 Alessio Igor Bogani [this message]
2011-04-16 13:26 ` [PATCH 1/4] module: Restructure each_symbol() code Alessio Igor Bogani
2011-04-19  1:31   ` Rusty Russell
2011-04-16 13:26 ` [PATCH 2/4] module: Sort exported symbols Alessio Igor Bogani
2011-04-16 13:26 ` [PATCH 3/4] lib: Add generic binary search function to the kernel Alessio Igor Bogani
2011-04-16 13:26 ` [PATCH 4/4] module: Use the binary search for symbols resolution Alessio Igor Bogani
2011-04-16 14:08   ` Wanlong Gao
2011-04-16 14:32   ` Wanlong Gao
2011-04-19  1:37     ` Rusty Russell
2011-04-19  1:44       ` Wanlong Gao
2011-04-19 11:35         ` Rusty Russell
2011-04-19 12:46           ` Wanlong Gao
2011-04-27 15:31 ` [PATCH 0/4] Speed up the symbols' resolution process V4 Dirk Behme
2011-05-11  3:32 ` Mike Frysinger
2011-05-11  7:04   ` Alessio Igor Bogani
2011-05-11  9:19     ` Alessio Igor Bogani
2011-05-11 13:44       ` Alessio Igor Bogani
2011-05-11 14:47       ` Mike Frysinger
2011-05-11 15:25         ` Alessio Igor Bogani
2011-05-11 15:52           ` Mike Frysinger
2011-05-12  9:10             ` Alessio Igor Bogani
2011-05-12 14:30               ` Mike Frysinger
2011-05-13  7:01                 ` Alessio Igor Bogani
2011-05-14 17:32                   ` Mike Frysinger
2011-05-15  8:28                     ` Alessio Igor Bogani

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=1302960373-5309-1-git-send-email-abogani@kernel.org \
    --to=abogani@kernel.org \
    --cc=andersk@ksplice.com \
    --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 read-only IMAP folder(s) and NNTP newsgroup(s).