[Top] [All Lists]

Freeing global memory used only by __init functions

Subject: Freeing global memory used only by __init functions
From: Gerald Champagne <>
Date: Tue, 18 Sep 2001 12:58:19 -0500
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.3) Gecko/20010801
I noticed that several global buffers are used by a few functions marked
as __init functions.  I assume that the code space used by these functions
will be freed up when kernel initialization is completed, but can the
associated global memory be freed up as well?

An example can be found in arch/mips/mips-boards/generic/cmdline.c:

char arcs_cmdline[COMMAND_LINE_SIZE];
char * __init prom_getcmdline(void);
void  __init prom_init_cmdline(void);

arcs_cmdline is only used by these two functions and one other function
marked as __init.

This buffer is small, but it can apply to larger buffers as well.  For
example, in arch/mips/mips-boards/generic/printf.c, I think the functions
putPromChar and getPromChar should be marked as __init functions, and the
1k buffer "buf" is never used after initialization.  Can this 1k be recovered?

I know kmalloc could normally be used in kernel code, but that won't work on
initialization code used before kmalloc is initialized.



<Prev in Thread] Current Thread [Next in Thread>