Re: Why sleeping not allowed after preempt_disable()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



2007/5/15, Gaurav Bhatnagar <bhatnagar.gaurav22@xxxxxxxxx>:
if you set disable preemption ... kernel can't schedule another thread until
thread itself leave the cpu ... if this thread sleeps who will wake it up
??? this would lead to deadlock ..
gaurav


I do not think the potential dead-lock is the reason, because the
sleep operation is exactly the operation of relinquishing CPU. So if a
process disable preemption and then sleep, the scheduler will be
invoked and another process will use CPU. No dead-lock here.

I think the reason lies in why you are about to use preemption
disabling in the first place. When you use preemption disabling, you
managed to define a critical region within which your data structure
is protected from being corrupted by another process. But if you put a
sleep in that critical region, I think you actually split your
original critical region into two regions in purpose so you should
encompass each region by one pair of preempt_disable/enable
respectively.

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux