Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id ; Thu, 4 Apr 2002 17:40:44 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id ; Thu, 4 Apr 2002 17:40:35 -0500 Received: from vasquez.zip.com.au ([203.12.97.41]:26639 "EHLO vasquez.zip.com.au") by vger.kernel.org with ESMTP id ; Thu, 4 Apr 2002 17:40:21 -0500 Message-ID: <3CACD5D3.B2DA02AE@zip.com.au> Date: Thu, 04 Apr 2002 14:38:11 -0800 From: Andrew Morton X-Mailer: Mozilla 4.79 [en] (X11; U; Linux 2.4.19-pre4 i686) X-Accept-Language: en MIME-Version: 1.0 To: Roger Larsson CC: Robert Love , Linus Torvalds , Dave Hansen , "Adam J. Richter" , linux-kernel@vger.kernel.org Subject: Re: Patch: linux-2.5.8-pre1/kernel/exit.c change caused BUG() at boot time In-Reply-To: <1017948383.22303.537.camel@phantasy> <200204042334.04367.roger.larsson@norran.net> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Roger Larsson wrote: > > ... > How about doing: > > asmlinkage void preempt_schedule(void) > { > unsigned long saved_state; > > if (unlikely(preempt_get_count())) > return; > > preempt_disable(); /* or use an atomic operation */ > saved_state = current->state; > current->state = TASK_RUNNING; > preempt_enable_no_resched(); /* we are scheduling anyway... */ > schedule(); Interrupt occurs, puts this task in state TASK_RUNNING. > current->state = saved_state; whoops. We went back into TASK_UNINTERRUPTIBLE. > } > We could fix this with changes to schedule(), but that's not nice. Another approach would be: preempt_schedule() { current->state2 = current->state; current->state = TASK_RUNNING; schedule(); current->state = current->state2; } and wake_up() would do: tsk->state = TASK_RUNNING; tsk->state2 = TASK_RUNNING; With the appropriate locking, memory barriers and other relevant goo I think this would work... - - 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/