[patch 2/2] Link new module to the tail of module list

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



[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 <[email protected]>
-------------------------------------------------------------------

 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;
 }
 

--

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux