why is it necessary that irqs are disabled to preempt?

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

 



Hi,

According to ULK3, the preempt_enable() macro decreases the preemption
counter, then checks whether the TIF_NEED_RESCHED flag is set. In this
case, a process switch is peding, so the macro invokes the
preempt_schedule() function, which essentially executes the following
code:

    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?

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