Re: [PATCH] minor sched-E1 tweaks and questions

Davide Libenzi (davidel@xmailserver.org)
Wed, 9 Jan 2002 22:06:44 -0800 (PST)


On Thu, 10 Jan 2002, Rusty Russell wrote:

> Another question:
>
> if (likely(prev != next)) {
> rq->nr_switches++;
> rq->curr = next;
> next->cpu = prev->cpu;
> context_switch(prev, next);
> /*
> * The runqueue pointer might be from another CPU
> * if the new task was last running on a different
> * CPU - thus re-load it.
> */
> barrier();
> rq = this_rq();
> }
> spin_unlock_irq(&rq->lock);
>
> I do not understand this comment. How can rq (ie. smp_processor_id())
> change? Nothing sleeps here, and if it DID change, the
> spin_unlock_irq() would be wrong...

If you switch you'll on the stack the rq of the previous cpu
spin_unlock_irq(&rq->lock) is fine if you do not switch and if you switch
you need to reload rq

- Davide

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