From owner-freebsd-current@FreeBSD.ORG Wed Oct 20 02:00:41 2004 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id D875516A4CE for ; Wed, 20 Oct 2004 02:00:41 +0000 (GMT) Received: from duchess.speedfactory.net (duchess.speedfactory.net [66.23.201.84]) by mx1.FreeBSD.org (Postfix) with SMTP id 6D50343D5A for ; Wed, 20 Oct 2004 02:00:41 +0000 (GMT) (envelope-from ups@tree.com) Received: (qmail 12384 invoked by uid 89); 20 Oct 2004 02:00:40 -0000 Received: from duchess.speedfactory.net (66.23.201.84) by duchess.speedfactory.net with SMTP; 20 Oct 2004 02:00:40 -0000 Received: (qmail 12373 invoked by uid 89); 20 Oct 2004 02:00:40 -0000 Received: from unknown (HELO palm.tree.com) (66.23.216.49) by duchess.speedfactory.net with SMTP; 20 Oct 2004 02:00:40 -0000 Received: from [127.0.0.1] (localhost.tree.com [127.0.0.1]) by palm.tree.com (8.12.10/8.12.10) with ESMTP id i9K20c5R016121; Tue, 19 Oct 2004 22:00:39 -0400 (EDT) (envelope-from ups@tree.com) From: Stephan Uphoff To: Julian Elischer In-Reply-To: <41759681.1060700@elischer.org> References: <41759681.1060700@elischer.org> Content-Type: text/plain Message-Id: <1098237638.15834.105.camel@palm.tree.com> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 Date: Tue, 19 Oct 2004 22:00:38 -0400 Content-Transfer-Encoding: 7bit cc: FreeBSD Current Subject: Re: wakeup/sleep handoff. X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Oct 2004 02:00:42 -0000 On Tue, 2004-10-19 at 18:34, Julian Elischer wrote: > Is there a need to be able to somehow implement a 'wakeup_one()' that > as part of its semantic is that the woken thread will run immediatly, > (as in preemprion), > and the old thread will sleep? With preemption, the old thread is left > in the run queue, > and after the other thread has completed, it will > run again and probably go away and sleep for some reason.. (or at least > go do some work that isn't > necessarily required..) > > Something like handover(wakeupchan, sleepchan, msleep_args...). > sort of an atomic wakeup/msleep. > > This would be used in places where work used to be done by the same > thread, but is now done > by a server thread.. > > An example would be kicking off a geom thread, when in the past we would > have gone all > the way down to the hardware ourself. we want to get as close to acting > like we are still > going all the way done as we can (performance wise). We may get some > efficiency by > letting the sleep system, and scheduler know what we are trying to do. > Possibly with some > priority inherritance implications.. (if we have a high priority, we > probably want to ensure that the > worker thread is run with at least that priority.) Why not just give the geom thread a high priority? This, full preemption and changing a few functions to guaranty that the highest priority thread will always run should do what you want. ( And maybe always raising the priority of threads working in the kernel) Actually this is relatively high on my to do list and I should have some patches to try out in a week or two. Stephan