From owner-freebsd-current Mon Nov 26 9:43:44 2001 Delivered-To: freebsd-current@freebsd.org Received: from mail11.speakeasy.net (mail11.speakeasy.net [216.254.0.211]) by hub.freebsd.org (Postfix) with ESMTP id 6707C37B405 for ; Mon, 26 Nov 2001 09:43:33 -0800 (PST) Received: (qmail 27312 invoked from network); 26 Nov 2001 17:43:55 -0000 Received: from unknown (HELO laptop.baldwin.cx) ([64.81.54.73]) (envelope-sender ) by mail11.speakeasy.net (qmail-ldap-1.03) with SMTP for ; 26 Nov 2001 17:43:55 -0000 Message-ID: X-Mailer: XFMail 1.4.0 on FreeBSD X-Priority: 3 (Normal) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 8bit MIME-Version: 1.0 In-Reply-To: <20011123151522.B58238@iguana.aciri.org> Date: Mon, 26 Nov 2001 09:43:30 -0800 (PST) From: John Baldwin To: Luigi Rizzo Subject: Re: where is the idle_loop in current ? Cc: current@FreeBSD.org Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On 23-Nov-01 Luigi Rizzo wrote: > In order to port my network polling stuff to current, I was looking > at ways to do things within the "idle loop", and was pointed to > the idle_proc() or vm_pagezero() . I am listing below the code > for these kernel threads (I hope the name is the correct one). > > I do not follow, however, the reason why these two threads periodically > give up the CPU, given that their priority is (i guess) lower than > any other thread in the system, so any event that should wake up > a thread would immediately cause their preemption. > Where am i wrong ? We don't do preemption in the kernel yet, so they need to yield the CPU when another thread is available. The page zeroing thread does this wrong as it should check procrunnable() instead of switching after doing N pages. The idle loop idle_proc() can't do any work w/o breaking priority propagation. If you wish to do low priority work, create a idle priority kthread to do it and make sure it yields when there is other work to do of higher priority. -- John Baldwin <>< http://www.FreeBSD.org/~jhb/ "Power Users Use the Power to Serve!" - http://www.FreeBSD.org/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message