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

Linus Torvalds (torvalds@transmeta.com)
Mon, 1 Mar 1999 09:44:35 -0800 (PST)


On Mon, 1 Mar 1999, Ingo Molnar wrote:
>
> the attached patch fixes one more place that calls schedule() with
> interrupts disabled, which i think should not be allowed, for the sake of
> robustness.

Why not? There are tons of good reasons to disable interrupts on
scheduling, often because you want to avoid races with the people waking
you up, or something like that.

cli();
while (not_ready) {
waiting = 1;
current->state = TASK_UNINTERRUPTIBLE;
schedule();
}
.. ok, we have some data now ..

Now, the _clever_ way to avoid races is to use the wait-queues properly
(ie set up the wait queues and marking yourself asleep before doing the
tests for readiness), but the scheduler was originally _designed_ to be
entered with interrupts disabled so that people could take the "obvious"
approach instead.

In short, entering the scheduler with interrupts disabled should _not_ be
considered a "robustness" issue at all.

Linus

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