From owner-freebsd-hackers@FreeBSD.ORG Tue Jan 2 11:08:42 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 0CB1F16A40F for ; Tue, 2 Jan 2007 11:08:42 +0000 (UTC) (envelope-from anandhkrishnan@gmail.com) Received: from wr-out-0506.google.com (wr-out-0506.google.com [64.233.184.224]) by mx1.freebsd.org (Postfix) with ESMTP id C891013C45A for ; Tue, 2 Jan 2007 11:08:41 +0000 (UTC) (envelope-from anandhkrishnan@gmail.com) Received: by wr-out-0506.google.com with SMTP id 55so1805193wri for ; Tue, 02 Jan 2007 03:08:41 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; b=IvS5LbFGsSjyVTKznjkrHxiVRmK2N3LAmNBKImBONp54CMrPpYrfV5wF5r2E/XgVZowjTZuE6dbamDtZwZDWdQfh4RmIRs6IhvNZaiINvTy8ileNvyhv/HerOELCDxqelR/+tmVwGzyhc44TgoGGcreOgCWVf6mDqibwXaYo/hM= Received: by 10.90.113.18 with SMTP id l18mr14244941agc.1167734554715; Tue, 02 Jan 2007 02:42:34 -0800 (PST) Received: by 10.90.74.4 with HTTP; Tue, 2 Jan 2007 02:42:34 -0800 (PST) Message-ID: <9bf098930701020242t232a1131r355c693618169441@mail.gmail.com> Date: Tue, 2 Jan 2007 16:12:34 +0530 From: "Anand H. Krishnan" To: hackers@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline Cc: Subject: Doubts with scheduler code X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list 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 11:08:42 -0000 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