Re: scheduler: IRQs disabled over context switches

From: Ingo Molnar
Date: Mon May 24 2004 - 01:37:05 EST



* Russell King <rmk+lkml@xxxxxxxxxxxxxxxx> wrote:

> The 2.6.6 scheduler disables IRQs across context switches, which is
> bad news for IRQ latency on ARM - to the point where 16550A FIFO UARTs
> to overrun.
>
> I'm considering defining prepare_arch_switch & co as follows on ARM,
> so that we release IRQs over the call to context_switch().

> The question is... why are we keeping IRQs disabled over
> context_switch() in the first case? Looking at the code, the only
> thing which is touched outside of the two tasks is rq->prev_mm. Since
> runqueues are CPU- specific and we're holding at least one spinlock, I
> think the above is preempt safe and SMP safe.

historically x86 context-switching has been pretty fragile when done
with irqs enabled. (x86 has tons of legacy baggage, segments, etc.) It's
also slightly faster to do the context-switch in one atomic swoop. On
x86 we do this portion in like 1 usec so it's not a latency issue.

if on ARM context-switching latency gives you UART problems then you can
enables irqs via ARM-specific version of prepare_arch_switch() &
finish_arch_switch().

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