On 08/16/2010 03:48 AM, Parmenides wrote:
if (!current_thread_info->preempt_count&& !irqs_disabled()) { current_thread_info->preempt_count = PREEMPT_ACTIVE; schedule(); current_thread_info->preempt_count = 0; } The if statement checks whether irqs are enabled. If so, the preemption will be carried out. I wonder why this check is necessary. Why preemption is prohibited with irqs disabled?
Because the thread you are scheduling to, won't know that it needs to reenable interrupts. If interrupts stay disabled "forever", the CPU will not get any more interrupts, like interrupts that tell it to reschedule, move the clock forward, etc... -- To unsubscribe from this list: send an email with "unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx Please read the FAQ at http://kernelnewbies.org/FAQ