<div dir="ltr"><div>Yes, current->mm points to user space context for the current process. </div><div>Now for a kernel threads there is no user space context and for them current->mm would be NULL.</div><div> </div><div>
Thanks,</div><div>Chetan Nanda</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Nov 15, 2013 at 9:54 PM, Paul Davies C <span dir="ltr"><<a href="mailto:pauldaviesc@gmail.com" target="_blank">pauldaviesc@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div text="#000000" bgcolor="#FFFFFF">
Hi,<br>
I happen to find this code snippet in the kernel source :<br>
<br>
<b> </b><i><b>struct mm_struct *mm=current->mm</b><b>;</b><b><br>
</b><b><br>
/* some other code */<br>
<br>
</b><b> if(mm){ /*<==Why is </b><b>this here? */</b><b><br>
</b><b> /*read the contents by locking*/</b><b><br>
</b><b> }<br>
<br>
</b></i>The<i> if </i>checks whether the mm_struct of the
current process is NULL or not. That means the mm_struct of a
process can become NULL. How can that happen?<br>
</div>
<br>_______________________________________________<br>
Kernelnewbies mailing list<br>
<a href="mailto:Kernelnewbies@kernelnewbies.org">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>
<br></blockquote></div><br></div>