Re: freeing a static after one use only?

From: Peter T. Breuer (ptb@it.uc3m.es)
Date: Fri Feb 18 2000 - 06:42:19 EST


"A month of sundays ago Jeff Garzik wrote:"
> "Peter T. Breuer" wrote:
> >
> > static CrossRef uIndex[] __initlocaldata = {
> > #include "all_config.data"
> > { 0 , 0 },
> > };
> >
> > setup.c: In function `init_module':
> > setup.c:81: syntax error before `__initlocaldata'
> >
> > (commenting out the __initlocaldata makes it all OK).
>
> #include <linux/init.h> ??

No. It's just that the __init stuff is disabled if defined(MODULE).

Apparently the kernel doesn't presently know how to discard inits in
modules, although modutils can do it. Jakub Jelinek has an old patch
that will do the trick. I suppose it would be a win-only situation if
the patch were put in the kernel? Either one could choose to mark all
init_module functions as __initfunction, or do it on a one-by-one basis.
But either way space would be reclaimed from modules. The question is
if it matters? Modules are apparently in a space that can be swapped
out. Should I even care that my module currently takes 40KB of memory,
due partially at least to one 10KB+ static data array that can be
jetisoned after init?

As Alan remarked, the other approach is to read in the data from
userland via an ioctl after init_module. And don't start the driver
up until then.

That approach might be workable. It makes the module harder to use,
however, and convenience is much of the reason behind doing ANYTHING
with software.

Peter

-
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/



This archive was generated by hypermail 2b29 : Wed Feb 23 2000 - 21:00:21 EST