Linux-kernel mailing list archive 2000-07,: Re: freeing a static after one use only?

# Re: freeing a static after one use only?

Peter T. Breuer (ptb@it.uc3m.es)
Fri, 18 Feb 2000 12:42:19 +0100 (MET)

- Messages sorted by: [ date ][ thread ][ subject ][ author ]
- Next message: Artur Skawina: "Re: 210ms interval between two schedule() calls - is it possible?"
- Previous message: Andre Hedrick: "Re: [PATCH 2.3.x] IDE probe fix"
- Next in thread: Anton Altaparmakov: "Re: freeing a static after one use only?"
- Reply: Anton Altaparmakov: "Re: freeing a static after one use only?"

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

- Next message: Artur Skawina: "Re: 210ms interval between two schedule() calls - is it possible?"
- Previous message: Andre Hedrick: "Re: [PATCH 2.3.x] IDE probe fix"
- Next in thread: Anton Altaparmakov: "Re: freeing a static after one use only?"
- Reply: Anton Altaparmakov: "Re: freeing a static after one use only?"