I have a couple of questions for sleep_on(). The questions are basically regarding to the situation in which function sleep_on() can be invoked. For my understanding, sleep_on() can be invoked only when: 1. The event (or condition) for which it waits must not be triggered (or met) by an interrupt handler. 2. The event (or condition) for which it waits must not be triggered (or met) by a CPU other than the CPU running the waiting thread. In other words, I think the event (or condition) the sleep_on() waits for must be tightly stuck or bound to one particular CPU, and not be touched by interrupt. The reason I think that invoking sleep_on() should have the above constraints is because sleep_on() does not acquire any locks (except for the lock protecting the waiting list, but the critical region is too small to protect any upper-level logical integrity). For example, if we use the following code: while(!condition) { sleep_on(...); } The code will enter into an infinite wait if something making the condition met happens in an interrupt handler or on another CPU after the while but before the sleep_on(). In this case, we would like to use: spin_lock(&upper_level_lock); while(!condition) { current->state = TASK_UNINTERRUPTIBLE; add_wait_queue(...); spin_unlock(&upper_level_lock); schedule(); remove_wait_queue(...); spin_lock(&upper_level_lock); } ... spin_unlock(&upper_level_lock); Could anyone please confirm whether the constraints I put are enough and complete? I need this confirmation in order to assure my understanding to when the sleep_on() is suitable for invoke. Thank you in advance. -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/