Linux MIPS Architecture development
 help / color / mirror / Atom feed
* Freeing global memory used only by __init functions
@ 2001-09-18 17:58 Gerald Champagne
  0 siblings, 0 replies; 4+ messages in thread
From: Gerald Champagne @ 2001-09-18 17:58 UTC (permalink / raw)
  To: linux-mips

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.

Thanks.

Gerald

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Freeing global memory used only by __init functions
@ 2001-09-18 18:08 Zhang Fuxin
  0 siblings, 0 replies; 4+ messages in thread
From: Zhang Fuxin @ 2001-09-18 18:08 UTC (permalink / raw)
  To: Gerald Champagne; +Cc: linux-mips@oss.sgi.com

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:
>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.
>
>Thanks.
>
>Gerald

Regards
            Zhang Fuxin
            fxzhang@ict.ac.cn

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Freeing global memory used only by __init functions
       [not found] <200109181808.LAA05245@mail.esstech.com>
@ 2001-09-18 18:37 ` Gerald Champagne
  2001-09-19  1:02   ` Ralf Baechle
  0 siblings, 1 reply; 4+ messages in thread
From: Gerald Champagne @ 2001-09-18 18:37 UTC (permalink / raw)
  To: Zhang Fuxin; +Cc: linux-mips@oss.sgi.com

Thanks for the reply.  Sorry I didn't find the __initdata
attribute.  Is this stuff worth patching?

I'd make the following changes as a start:

in arch/mips/mips-boards/generic/printf.c:
Add __init to putPromChar
Add __init to getPromChar
Add __initdata to buf  (1k buffer)

in arch/mips/mips-boards/generic/cmdline.c:
Add __initdata to arcs_cmdline

Can someone point to a set of rules for submitting patches
for linux-mips?  I'm familiar with the methods used for the
kernel.  Is this the same?  I'm using 2.4.3 from the mips site.
Can I patch against that, or do I have to start from a
certain cvs version?

Thanks!

Gerald


Zhang Fuxin wrote:
> 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:
> 
>>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.
>>
>>Thanks.
>>
>>Gerald
>>
> 
> Regards
>             Zhang Fuxin
>             fxzhang@ict.ac.cn
> 
> 
> 
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Freeing global memory used only by __init functions
  2001-09-18 18:37 ` Gerald Champagne
@ 2001-09-19  1:02   ` Ralf Baechle
  0 siblings, 0 replies; 4+ messages in thread
From: Ralf Baechle @ 2001-09-19  1:02 UTC (permalink / raw)
  To: Gerald Champagne; +Cc: Zhang Fuxin, linux-mips@oss.sgi.com

On Tue, Sep 18, 2001 at 01:37:31PM -0500, Gerald Champagne wrote:

> Can someone point to a set of rules for submitting patches
> for linux-mips?  I'm familiar with the methods used for the
> kernel.  Is this the same?  I'm using 2.4.3 from the mips site.
> Can I patch against that, or do I have to start from a
> certain cvs version?

Please send unified diffs relative to the latest revision of the CVS
archive from oss.sgi.com to me by mail.  Same rulesSee
http://oss.sgi.com/mips/mips-howto.html for how to access CVS.  See also
Documentation/SubmittingPatches in your kernel tree.

  Ralf

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2001-09-19  1:02 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-09-18 17:58 Freeing global memory used only by __init functions Gerald Champagne
  -- strict thread matches above, loose matches on Subject: below --
2001-09-18 18:08 Zhang Fuxin
     [not found] <200109181808.LAA05245@mail.esstech.com>
2001-09-18 18:37 ` Gerald Champagne
2001-09-19  1:02   ` Ralf Baechle

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox