This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
[patch 2/2] Link new module to the tail of module list
- From: Anil S Keshavamurthy <anil dot s dot keshavamurthy at intel dot com>
- To: Linux Kernel <linux-kernel at vger dot kernel dot org>, akpm at osdl dot org
- Cc: tony dot luck at intel dot com, "Systemtap" <systemtap at sources dot redhat dot com>, "Jim Keniston" <jkenisto at us dot ibm dot com>, "Keith Owens" <kaos at sgi dot com>, Anil S Keshavamurthy <anil dot s dot keshavamurthy at intel dot com>
- Date: Tue, 10 Jan 2006 12:39:14 -0800
- Subject: [patch 2/2] Link new module to the tail of module list
- References: <20060110203912.007577046@csdlinux-2.jf.intel.com>
[PATCH] Link new module to the tail of module list
When we are linking/adding a new module, it would be
better to insert the new module to the tail of the
module list.
The reason is when kallsyms_lookup_name(name)
looks for the text address corresponding to the name
from the head of the module list, we always hit the
module exporting the text address first and then the
module using the text address later. This helps
kallsyms_lookup_name() search which indeed need
the text address.
Signed-off-by: Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com>
-------------------------------------------------------------------
kernel/module.c | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletion(-)
Index: linux-2.6.15-mm1/kernel/module.c
===================================================================
--- linux-2.6.15-mm1.orig/kernel/module.c
+++ linux-2.6.15-mm1/kernel/module.c
@@ -1911,7 +1911,12 @@ static struct module *load_module(void _
static int __link_module(void *_mod)
{
struct module *mod = _mod;
- list_add(&mod->list, &modules);
+ /* Insert the new modules at the tail of the list,
+ * so kallsyms_lookup_name finds the module exporting
+ * the text address of a function first and quickens
+ * the search when searching based on function name
+ */
+ list_add_tail(&mod->list, &modules);
return 0;
}
--