lkml.org 
[lkml]   [2001]   [Apr]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectSuggestion for module .init.{text,data} sections
	A while ago, on linux-kernel, we had a discussion about
adding support for __initdata and __init in modules. Somebody
(whose name escapes me) had implemented it by essentially adding
a vmrealloc() facility in the kernel. I think I've thought of a
simpler way, that would require almost no kernel changes.

Have insmod split the module into two parts and load them
as two modules. First, create the regular part of the module as usual
(without .data.init and .text.init), except with no initialization
routine set. Second, create a module from the .data.init and the
.text.init sections (if any), with it's initialization routine set
to the module's init_module routine, even if that routine resides
in the first module. Third, there will be cross references between
these two modules, so will generally be necessary to resolve the
relocations before loading either module. Fourth, load the first
module. This will always succeed, since there is no initialization
routine to fail. Fifth, load the second module, the one made of .data.init
and .text.init. It will run the actual module_init function. If the
module initialization routine fails, both modules are unloaded and
the usual failure behavior happens. If the module initialization
succeeds, the ".init" module (the second module) is unloaded.

Potentially, this could save some memory footprint in
highly modularized systems and cleanup linux/include/init.h.
I guess I would imagine this as a potential 2.5 feature, or
perhaps as a default-off option intended soley for stress testing
in 2.4.

I started looking through the modutils sources, but I was
a little disappointed to discover that it is ELF-specific rather
than written in bfd, as I am pretty unfamiliar with ELF innards but
a little more conversant in bfd. Maybe I'll take a whack at it yet,
but I figure I should at least pass the idea along and see if I'm
overlooking anything obvious.

Adam J. Richter __ ______________ 4880 Stevens Creek Blvd, Suite 104
adam@yggdrasil.com \ / San Jose, California 95129-1034
+1 408 261-6630 | g g d r a s i l United States of America
fax +1 408 261-6631 "Free Software For The Rest Of Us."
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 12:52    [W:0.128 / U:0.080 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site