From owner-freebsd-current@FreeBSD.ORG Fri Jan 18 09:36:19 2008 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3347B16A468 for ; Fri, 18 Jan 2008 09:36:19 +0000 (UTC) (envelope-from des@des.no) Received: from tim.des.no (tim.des.no [194.63.250.121]) by mx1.freebsd.org (Postfix) with ESMTP id D172713C45D for ; Fri, 18 Jan 2008 09:36:18 +0000 (UTC) (envelope-from des@des.no) Received: from tim.des.no (localhost [127.0.0.1]) by spam.des.no (Postfix) with ESMTP id 5F99A2087; Fri, 18 Jan 2008 10:36:10 +0100 (CET) X-Spam-Tests: AWL X-Spam-Learn: disabled X-Spam-Score: -0.2/3.0 X-Spam-Checker-Version: SpamAssassin 3.2.3 (2007-08-08) on tim.des.no Received: from ds4.des.no (des.no [80.203.243.180]) by smtp.des.no (Postfix) with ESMTP id 31B1A2086; Fri, 18 Jan 2008 10:36:10 +0100 (CET) Received: by ds4.des.no (Postfix, from userid 1001) id 064ED844C5; Fri, 18 Jan 2008 10:36:10 +0100 (CET) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: Nate Lawson References: <478930D2.90806@digifonica.com> <200801171115.43663.doconnor@gsoft.com.au> <86myr4n4gp.fsf@ds4.des.no> <478F8A75.5010701@root.org> Date: Fri, 18 Jan 2008 10:36:09 +0100 In-Reply-To: <478F8A75.5010701@root.org> (Nate Lawson's message of "Thu\, 17 Jan 2008 09\:03\:49 -0800") Message-ID: <86y7aneara.fsf@ds4.des.no> User-Agent: Gnus/5.110006 (No Gnus v0.6) Emacs/22.1 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: freebsd-current@freebsd.org, Maxim Sobolev , Igor Mozolevsky , Stefan Lambrev Subject: Re: powerd adaptive mode latching X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 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: Fri, 18 Jan 2008 09:36:19 -0000 Nate Lawson writes: > Dag-Erling Sm=C3=B8rgrav writes: > > [powerd's load calculation] is based on the (didle/dt) / (dtotal/dt) > > fraction computed from kern.cp_time, which can take a while to ramp > > up. This is not easily seen in a cursory reading of the code, as the > > fraction is computed in a very roundabout way. > While providing more accurate information to powerd is a good goal, I > want to preempt any requests to move the scheduling algorithm into the > kernel. Never struck my mind. Policy belongs in userland. However, the load calculations could benefit from a (semantically identical) rewrite, if only to make them more easily understandable to the reader. I would rename a couple of variables to make it clear that they are derivatives, compute the fraction explicitly, and use an internal representation of the threshold that places it in [0..1] instead of [0..100], allowing a direct comparison. DES --=20 Dag-Erling Sm=C3=B8rgrav - des@des.no