Freeing global memory used only by __init functions
hi,Gerald Champagne,
I think __initdata attribute is the answer.You just need to
put init data in init data section(via __initdata),there are many examples in kernel.
在 2001-09-18 12:58:00 you wrote:
Quoted 19 lines
I noticed that several global buffers are used by a few functions marked as
__initfunctions. 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 *__initprom_getcmdline(void);
void__initprom_init_cmdline(void);
arcs_cmdlineis 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__initfunctions, and the 1k buffer "buf" is never used after initialization. Can this 1k be recovered?
Quoted 6 lines
I know kmalloc could normally be used in kernel code, but that won't work on initialization code used before kmalloc is initialized.
Thanks.
Gerald
Regards
Zhang Fuxin
[email protected]