good explanation of __read_mostly, __init, __exit macros,

Sannu K sannumail4foss at gmail.com
Mon Jul 16 08:01:06 EDT 2012


On Mon, Jul 16, 2012 at 4:52 PM, Aft nix <aftnix at gmail.com> wrote:

> Hi,
>
> The macro expansion of __read_mostly :
>
> #define __read_mostly __attribute__((__section__(".data..read_mostly"))
>
> This one is from cache.h
>
> __init:
> #define __init          __section(.init.text) __cold notrace
>
> from init.h
>
> __exit:
>
> #define __exit          __section(.exit.text) __exitused __cold notrace
>
> After searching through net i have not found any good explanation of
> what is happening there.
>
> Additonal question : I have heard about various "linker magic"
> employed in kernel development. Any information
> regarding this will be wonderful.
>
> cheers
>
> --
> -aft
>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>


Using __init means the function code will be removed - saving RAM space
i.e., one cannot call the function declared with __init once the
initialization is done. I just know the meaning but I am not sure of how it
works. This may provide some info on your question even though it did not
answer your question.

Hope this Helps,
Sannu K
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20120716/fd6f6def/attachment.html 


More information about the Kernelnewbies mailing list