<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Dec 25, 2013 at 3:29 PM, SaNtosh kuLkarni <span dir="ltr"><<a href="mailto:santosh.yesoptus@gmail.com" target="_blank">santosh.yesoptus@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 dir="ltr">Hi,<div><br></div><div>I wanted to verify/clarify if using schedule_timeout after acquiring a spinlock is safe?.</div>
</div></blockquote><div><br></div><div>No it is not safe. schedule_timeout is sleepy function and it is<br>wrong to sleep when holding a spin lock. <br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr"><div> So basically you have a situation where you are working on a critical code and you acquire a spin lock and you end up using a schedule_timeout after say setting the current task to Interruptible state 'cause you are waiting for some user space code to fill in some buffer from which you want to read.</div>
<div>So my doubt is simple, is it safe to acquire a spinlock and use schedule_timeout.</div><div>I assume the task is put in the run queue and will "ALWAYS" be scheduled back after the specified delay in schedule_timeout.<span class="HOEnZb"><font color="#888888"><br clear="all">
<div><br></div>-- <br><b style="color:rgb(102,102,204)">Regards,<br>Santosh</b><br>
</font></span></div></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><div class="gmail_extra">Thanks,<br></div><div class="gmail_extra">Arshad<br></div></div>