Re: [patch] entry.S calling schedule() with interrupts disabled, 2.2.2

Ingo Molnar (mingo@chiara.csoma.elte.hu)
Mon, 1 Mar 1999 19:52:30 +0100 (CET)


On Mon, 1 Mar 1999, Alan Cox wrote:

> > schedule() with interrupts disabled, and remove that __sti() from the
> > context switch path :) After changing sleep_on* and ret_from_irq i can see
> > no other places that call schedule() with interrupts disabled.
>
> Look harder, lots of drivers and net stuff does. Its a standard scheme to
> avoid races
>
> cli();
> while(foo)
> {
> if(something_case)
> break;
> sleep_on*(&blah);
> }
> restore_flags(flags);

this is not exactly the case here. sleep_on() does preserve interrupt
state. What i'm trying to achieve is to:

1) catch possibly buggy code that relies on schedule() (not sleep_on)
preserving irq state. (which it doesnt)

2) a small performance optimization, sleep_on() could just enable
interrupts, then some other code that doesnt want to disable
interrupts can just call schedule() without having any spurious
__sti() in the way. eg. __wait_on_page does not want to deal with
interrupts at all because it can do its test in an atomic way. (i've
checked some other places too, and there are lots of places which can
do atomic tests, without disabling interrupts).

this is pretty much like the schedule_timeout() optimization, to 'offload'
things from the main scheduler, into 'utility' functions, which might (or
might not) do that particular thing.

-- mingo

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