From owner-freebsd-hackers@FreeBSD.ORG Tue Jan 2 20:39:53 2007 Return-Path: X-Original-To: hackers@freebsd.org Delivered-To: freebsd-hackers@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 6EC6E16A403 for ; Tue, 2 Jan 2007 20:39:53 +0000 (UTC) (envelope-from zombyfork@gmail.com) Received: from wr-out-0506.google.com (wr-out-0506.google.com [64.233.184.236]) by mx1.freebsd.org (Postfix) with ESMTP id 3173513C43E for ; Tue, 2 Jan 2007 20:39:53 +0000 (UTC) (envelope-from zombyfork@gmail.com) Received: by wr-out-0506.google.com with SMTP id 55so1918774wri for ; Tue, 02 Jan 2007 12:39:52 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:references; b=N3AsilENK8lxYGQ7Ef0XzAhNhcB4oi3+amB1vbHkM7cXiahOIUxmSV1+UbK2eIe/9TkbF9KbH6vvX2hf1G5HOYFEbI1bh/5J0ijFnudsXqAKn3/aouaJGcf8ZHBXH5jOPBwCBiaUlOgZCV84530DTa7ic7M8cqwm9JXHM0+Ox7U= Received: by 10.90.94.2 with SMTP id r2mr5535481agb.1167768915911; Tue, 02 Jan 2007 12:15:15 -0800 (PST) Received: by 10.90.101.15 with HTTP; Tue, 2 Jan 2007 12:15:15 -0800 (PST) Message-ID: <346a80220701021215h91ea76dr5a32b6ebe5bb1362@mail.gmail.com> Date: Tue, 2 Jan 2007 13:15:15 -0700 From: "Coleman Kane" To: "Anand H. Krishnan" In-Reply-To: <9bf098930701020242t232a1131r355c693618169441@mail.gmail.com> MIME-Version: 1.0 References: <9bf098930701020242t232a1131r355c693618169441@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: hackers@freebsd.org Subject: Re: Doubts with scheduler code X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: cokane@cokane.org List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Jan 2007 20:39:53 -0000 On 1/2/07, Anand H. Krishnan wrote: > > Hi, > > I had a couple of doubts when I was going through 6.1 freebsd code. > > * First one is in the wakeup() code. After a series of calls wakeup() > lands in maybe_preempt() and if preemption is enabled maybe_preempt() > switches to a new thread (if a high priority thread has been made > runnable). > That means that an interrupt handler which calls wakeup() will not return > immediately. (I'm looking @ ULE scheduler). > > So is there a problem when wakeup() is called from high priority (fast > interr > upt) handlers ? > > * Second one is in spinlock code. Can anyone say why critical_enter is > called from spinlock_enter() ? The only thing that critical_enter seems to > be doing is to increment td_critnest which probably helps in finding out > whether a thread can be pre-empted or not. But spinlock_enter() disables > interrupts and I fail to understand how can any thread become runnable > and get scheduled in between. > > I've one more.. > > * msleep() allows a thread to change it's priority when it gets woken up > and > in many places they gets woken up with very high priority indeed. Is there > any convincing reason as to why it should be ? > > Thanks, > Anand Anand, If I remember correctly a significant amount of the ULE scheduler code from 6.1 (and 7-CUR at that time) has been overhauled. In fact, the scheduler was taken off the list of "working" due to a bunch of problems. You may want to review the versions of the scheduler code from the latest -CURRENT or 6.2-RELEASE and then re-ask... -- Coleman Kane