Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id ; Mon, 14 Jan 2002 02:58:25 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id ; Mon, 14 Jan 2002 02:58:16 -0500 Received: from mx2.elte.hu ([157.181.151.9]:6027 "HELO mx2.elte.hu") by vger.kernel.org with SMTP id ; Mon, 14 Jan 2002 02:58:13 -0500 Date: Mon, 14 Jan 2002 10:55:37 +0100 (CET) From: Ingo Molnar Reply-To: To: Davide Libenzi Cc: Jeff Dike , Linus Torvalds , Subject: Re: The O(1) scheduler breaks UML In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org On Sun, 13 Jan 2002, Davide Libenzi wrote: > > So, is it possible to enable IRQs across the call to _switch_to? > > Yes, this should work : > > if (likely(prev != next)) { > rq->nr_switches++; > rq->curr = next; > next->cpu = prev->cpu; > spin_unlock_irq(&rq->lock); > context_switch(prev, next); > } else > spin_unlock_irq(&rq->lock); this change is incredibly broken on SMP - eg. what protects 'prev' from being executed on another CPU prematurely. It's even broken on UP: interrupt context that changes current->need_resched needs to be aware of nonatomic context switches. See my previous mail. > and there's no need for barrier() and rq reload in this way. we can remove the barrier(), but for a different reason: the asm volatile definition of the switch_to macro is a compilation barrier in itself already. I've removed the barrier() from my tree, the change will be in the -H8 patch. The rq = this_rq() reload is still necessery. Ingo - 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/