Spinlocks & schedule_timeout

arshad hussain arshad.super at gmail.com
Thu Dec 26 01:02:42 EST 2013

On Wed, Dec 25, 2013 at 3:29 PM, SaNtosh kuLkarni <
santosh.yesoptus at gmail.com> wrote:

> Hi,
> I wanted to verify/clarify if using schedule_timeout after acquiring a
> spinlock is safe?.

No it is not safe. schedule_timeout is sleepy function and it is
wrong to sleep when holding a spin lock.

> 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.
> So my doubt is simple, is it safe to acquire a spinlock and use
> schedule_timeout.
> I assume the task is put in the run queue and will "ALWAYS"
> be scheduled back after the specified delay in schedule_timeout.
> --
> *Regards,Santosh*
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20131226/5c090433/attachment.html 

More information about the Kernelnewbies mailing list