Hi, Not commenting on code snippet you have given.But in general i can say sleeping with interrupts disabled are not good for real time processes. For example the lower priority task sleeps with interrupts disabled and higher priority task wants attention. As it has to complete its work within dealine the higher task will miss its deadline as it is not going to schedule until unless interrupts are enabled again. For the same reason the interrupt emulation(By Victor Yodaiken) in RTLinux has done. In brief its not good for higher priority tasks in non-real time environment also. More you can know about that in paper on RTLinux. Prasanna --- Gopu Bhaskar <gopubhaskar@xxxxxxxx> wrote: > Is it OK to sleep when interrupts are disabled ? > The following is the implementation of > interruptible_sleep_on in 2.6.10 > Here we see that interrupts are disabled before > schedule is called and > enabled back only when the control comes back. I > wanted to know the > reason for doing this. And also whether sleeping > with interrupts disabled > has any negetive impact. > > 2872 #define SLEEP_ON_VAR > \ > 2873 unsigned long flags; > \ > 2874 wait_queue_t wait; > \ > 2875 init_waitqueue_entry(&wait, current); > 2876 > 2877 #define SLEEP_ON_HEAD > \ > 2878 spin_lock_irqsave(&q->lock,flags); > \ > 2879 __add_wait_queue(q, &wait); > \ > 2880 spin_unlock(&q->lock); > 2881 > 2882 #define SLEEP_ON_TAIL > \ > 2883 spin_lock_irq(&q->lock); > \ > 2884 __remove_wait_queue(q, &wait); > \ > 2885 spin_unlock_irqrestore(&q->lock, > flags); > 2886 > 2887 void fastcall __sched > interruptible_sleep_on(wait_queue_head_t *q) > 2888 { > 2889 SLEEP_ON_VAR > 2890 > 2891 current->state = TASK_INTERRUPTIBLE; > 2892 > 2893 SLEEP_ON_HEAD > 2894 schedule(); > 2895 SLEEP_ON_TAIL > 2896 } > > Gopu. > -- > ___________________________________________________________ > Sign-up for Ads Free at Mail.com > http://promo.mail.com/adsfreejump.htm > > > -- > Kernelnewbies: Help each other learn about the Linux > kernel. > Archive: > http://mail.nl.linux.org/kernelnewbies/ > FAQ: http://kernelnewbies.org/faq/ > > __________________________________ Do you Yahoo!? Yahoo! Small Business - Try our new resources site! http://smallbusiness.yahoo.com/resources/ -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/