Re: Q: preemptible kernel and interrupts consistency.

From: Robert Love (rml@tech9.net)
Date: Thu Jul 11 2002 - 15:41:47 EST


On Thu, 2002-07-11 at 13:33, Oleg Nesterov wrote:

> Documentation/preempt-locking.txt states, that
> disabled interrupts prevents preemption.
>
> Well, unless process does not touch TIF_NEED_RESCHED.

Yes, you are right, if need_resched is set under you, you will preempt
off the last unlock, even if interrupts are disabled.

However, the only places that set need_resched like that are the
scheduler and they do so also under lock so we are safe.

Also, in your example, being in an interrupt handler bumps the
preempt_count so even the scenario you give will not cause a
preemption. If we did not bump the unlock, then your example would give
a lot of "scheduling in interrupt" BUGs so we would know it ;-)

All that said, there is a bug: the send_reschedule IPI can set
need_resched on another CPU. If the other CPU happens to have
interrupts disabled, we can in fact preempt. I have a patch for this I
will submit shortly.

        Robert Love

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Mon Jul 15 2002 - 22:00:20 EST