Re: nanosleep

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

 



On 7/7/07, Bhanu Kalyan Chetlapalli <chbhanukalyan@xxxxxxxxx> wrote:
On 7/7/07, Rajat Jain <Rajat.Jain@xxxxxxxxxxxx> wrote:
>
>
>
> Hi,
>
> > And if you don't want the kernel to preempt you you can disable
> > preemption while doing your sleeping...  not very well behaved kernel
> > code, but you can do it...
>
> Huh? So something like following is allowed?
>
> preempt_disable();
> udelay(5);
> preempt_enable();
>
> ?????
>
> I must admit, this is a shock to me.

Hmmm even I think this is not possible, because these functions call
the schedule() function, which should not be done in atomic context.
It does a check for in_atomic() which checks the preempt_counter().

"these functions"? udelay() is a busy-loop, no sleeping, so it is fine
in atomic contexts. Fine in the sense of allowed, not fine in the
sense of good code (although there can be justified uses).

Thanks,
Nish

--
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