How to understand the macro __init?
Amarnath Revanna
amarnath.revanna at gmail.com
Thu Aug 16 15:41:40 EDT 2012
On Fri, Aug 17, 2012 at 12:19 AM, Ezequiel Garcia <elezegarcia at gmail.com>wrote:
> Hey Amar,
>
> On Thu, Aug 16, 2012 at 3:39 PM, Amarnath Revanna
> <amarnath.revanna at gmail.com> wrote:
> > Just want to add a little more for better understanding:
> >
> > When I spoke about .init section of the final kernel image, please note
> that
> > this section is going to
> > contain all the __init data (and functions) coming from _All_ the drivers
> > and modules that were included
> > as part of the kernel image. Hence, after initialization when we look at
> the
> > print:
> >
> > " [1.011596] Freeing unused kernel memory: 664k freed "
> >
> > we see 664k bytes being freed.
> >
> > This is a significant amount of contiguous physical memory that we can
> see
> > being released by the kernel.
> >
> > The same cannot be held true for a single loadable module which may be
> > releasing just a few, virtually
> > contiguous memory.
> >
>
> It's crystal clear ;-) Nice explanation. It's important to add
> something to clearify a bit your
> explanation (please correct me if I'm wrong):
>
> When Amar is talking about "virtually contiguous" kernel memory he
> implies that this
> memory is physically *dis*contiguous, i.e. based on page-entries.
> This is the kind of memory used for loadable modules,
> for instance, modules that get loaded with modprobe.
>
> On the other hand, built-in modules are compiled *inside* the kernel
> image (bzImage).
> The memory used for this image is physically contiguous: it's a big
> contiguous block
> of memory pages. Contiguous memory is important for kernel, and therefore
> is *very* important to spend some effort minimizing it.
>
Ezequiel,
Thanks for adding the clarification here :-)
Regards,
-Amar
>
> Regards,
> Ezequiel.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20120817/c507aa5b/attachment-0001.html
More information about the Kernelnewbies
mailing list