Re: __init & __exit

Petr Vandrovec Ing. VTEI (VANDROVE@vc.cvut.cz)
Tue, 10 Aug 1999 18:11:24 MET-1


On 10 Aug 99 at 11:36, Horst von Brand wrote:
> > It requires some cooperation from modutils - it knows which module depends
> > on which, so you cannot release foo-init. And it has no idea about __init -
> > it could eventually lead to call into released memory on another module
> > insmod. And, unfortunately, you cannot use this aproach for objects build
> > into kernel - these __init sections are stored only in kernel image, nowhere
> > else.
> Seems you misunderstood me: What the kernel does is stuff all the init code
> and data into separate segments (which are not intermingled with the
> rest). After using them, the memory is just reused. In the module case, you
Yea. I was thinking about it other way around - that you have module which
uses some functions from another helper module only during startup - but
that call comes from driver into helper module. But it is possible to arrange
it other way around.
> could do the same: Separate initialization stuff, and return its memory to
> the system after use. I doubt it is useful in general, as this will usually
> amount to a few bytes, and modules are allocated in 4K pages.
My kernel says 68kB released before starting init - and I have only AIC7870,
IPV4,UNIX,EXT2 and matroxfb+fbdev stuff compiled into kernel. Maybe that
it is in very small chunks from couple of modules, but maybe not. And if
you ever run 2.3.x with 8MB of memory, you'll find what 68kB of additional
memory means.
> The foo-{init,proper} would work without any changes AFAIKS if foo-init
> depended on foo-proper (sure will, as it meddles with its symbols :); then
> when you load foo-init, foo-proper gets loaded automatically, foo-init does
> its work and unloads (or marks itself unused, and gets reaped by the
> standard procedure).
If we can split it in the way that there is no call from foo-proper to
anything-init, then yes. But it does not solve problem where you'll find
init section if (hotplug) driver is compiled into kernel.
Petr Vandrovec
vandrove@vc.cvut.cz

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/