Spinlocks & schedule_timeout
santosh.yesoptus at gmail.com
Wed Dec 25 06:58:38 EST 2013
Sent from my Sony Xperia™ smartphone
On Dec 25, 2013 4:16 PM, "Pranay Srivastava" <pranjas at gmail.com> wrote:
> Hi santosh
> I hope you understand difference between semaphores and spin locks.
Ya I am completely aware of sleeping locks n spin locks
> If however you are stuck a situation where you can afford being preempted
then you can use sem/mutex. But i think your serialization requires that
you use spin locks then best is to have a guarded variable with spin lock
and release the lock before you schedule.
I just wanted to verify if it was possible n if yes considering preemption
> Even if you set the state preempt count would be increased when you
acquire spin lock. so you Cant schedule or go to sleep after spin lock.
Since schedule_timout would make sure the task remains on the run queue and
intended to be scheduled back after the specificed jeffies period. It was
just out of curiosity anyway .Thanks !!!
> On Dec 25, 2013 3:36 PM, "SaNtosh kuLkarni" <santosh.yesoptus at gmail.com>
>> I wanted to verify/clarify if using schedule_timeout after acquiring a
spinlock is safe?. 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
>> I assume the task is put in the run queue and will "ALWAYS"
be scheduled back after the specified delay in schedule_timeout.
>> Kernelnewbies mailing list
>> Kernelnewbies at kernelnewbies.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Kernelnewbies