<br><br><div class="gmail_quote">2012/8/16 Amarnath Revanna <span dir="ltr">&lt;<a href="mailto:amarnath.revanna@gmail.com" target="_blank">amarnath.revanna@gmail.com</a>&gt;</span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<span style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif">Hi Vijay,</span><div style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif">

<br></div><div style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif">Is this a loadable kernel module or a built-in module?</div><div style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif">


If it is a loadable module, everything still remains in the memory without being freed.</div><div style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif"><br></div><div style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif">


Functions and data defined with __init gets freed after their execution only if these are&nbsp;part of built-in kernel modules.</div><div style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif">

<br></div><div style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif">In your case, if the module is a loadable one, you can still access the print_k() from hello_exit() as its still residing in memory.</div>


<div style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif"><br></div><div style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif">

Regards,</div><div style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif">-Amar</div></blockquote><div><br></div><div>&nbsp; &nbsp;Hi Amar</div><div><br></div><div>&nbsp; &nbsp; &nbsp; &nbsp;Thank you &nbsp;very much &nbsp;for reply. I often write loadable modules,but know little about&nbsp;</div>
<div>built-in modules,can you tell something about built-in modules? or,how i can take a built-in</div><div>module into the kernel?</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="HOEnZb"><div class="h5"><br><div class="gmail_quote">On Thu, Aug 16, 2012 at 5:23 PM, Vijay Chauhan <span dir="ltr">&lt;<a href="mailto:kernel.vijay@gmail.com" target="_blank">kernel.vijay@gmail.com</a>&gt;</span> wrote:<br>


<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<div><br>
On Tue, Aug 14, 2012 at 9:34 AM, Mulyadi Santosa<br>
&lt;<a href="mailto:mulyadi.santosa@gmail.com" target="_blank">mulyadi.santosa@gmail.com</a>&gt; wrote:<br>
&gt; Hi.. :)<br>
&gt;<br>
&gt; On Tue, Aug 14, 2012 at 9:14 AM, ÍõÕÜ &lt;<a href="mailto:wangzhe5004@gmail.com" target="_blank">wangzhe5004@gmail.com</a>&gt; wrote:<br>
&gt;&gt; i use the __init for function print_k.<br>
&gt;&gt; in my opinion &nbsp;after the fisrt invoking the print_k in the hello_init.<br>
&gt;&gt; the memory of print_k will be freed,and the second invoking will<br>
&gt;&gt; not be executed.but the result of second invoking is executing .<br>
&gt;&gt;<br>
&gt;&gt; why?<br>
&gt;<br>
&gt; because you&#39;re still in module_init.... :)<br>
&gt;<br>
&gt; right after modul init stage is done, _init marked function is thrown away...<br>
<br>
<br>
</div>Even if we call &nbsp;print_k() function inside hello_exit, it still works.<br>
At that point __init hello_init execution is over. How its still<br>
working?<br>
<br>
<br>
Regards,<br>
Vijay<br>
<div><div><br>
&gt;<br>
&gt; --<br>
&gt; regards,<br>
&gt;<br>
&gt; Mulyadi Santosa<br>
&gt; Freelance Linux trainer and consultant<br>
&gt;<br>
&gt; blog: <a href="http://the-hydra.blogspot.com" target="_blank">the-hydra.blogspot.com</a><br>
&gt; training: <a href="http://mulyaditraining.blogspot.com" target="_blank">mulyaditraining.blogspot.com</a><br>
&gt;<br>
&gt; _______________________________________________<br>
&gt; Kernelnewbies mailing list<br>
&gt; <a href="mailto:Kernelnewbies@kernelnewbies.org" target="_blank">Kernelnewbies@kernelnewbies.org</a><br>
&gt; <a href="http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies" target="_blank">http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies</a><br>
<br>
_______________________________________________<br>
Kernelnewbies mailing list<br>
<a href="mailto:Kernelnewbies@kernelnewbies.org" target="_blank">Kernelnewbies@kernelnewbies.org</a><br>
<a href="http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies" target="_blank">http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies</a><br>
</div></div></blockquote></div><br>
</div></div></blockquote></div><br>