Re: [Linux-ia64] Help with Ingo scheduler on IA64

Ingo Molnar
2002-01-21T21:11:57Z

On Mon, 21 Jan 2002, Erich Focht wrote:

> what's the problem with the following code?
>
> switch_tasks:
> prev->need_resched = 0;
>
> if (likely(prev != next)) {
> rq->nr_switches++;
> rq->curr = next;
> spin_unlock_irq(&rq->lock); // <-
> context_switch(prev, next, 0);

the runqueue must not be unlocked before the current task is completely
inactive - otherwise another CPU could grab (or even free) this task.

Ingo