From owner-freebsd-arch@FreeBSD.ORG Mon Dec 17 20:17:56 2012 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 041128C6; Mon, 17 Dec 2012 20:17:56 +0000 (UTC) (envelope-from davide.italiano@gmail.com) Received: from mail-vb0-f54.google.com (mail-vb0-f54.google.com [209.85.212.54]) by mx1.freebsd.org (Postfix) with ESMTP id 853D38FC0A; Mon, 17 Dec 2012 20:17:55 +0000 (UTC) Received: by mail-vb0-f54.google.com with SMTP id l1so7768137vba.13 for ; Mon, 17 Dec 2012 12:17:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=dgTMgSHlhvv2LNpvLOg3HmEKKueXCoDfISnnecrQaH4=; b=vDNtf0VWQtycePzfTy/Fd95STGm2kvY1RTAmhZGVDExFhO20d8MVqDMK9bSHvdk29F 0Xs+wnho935+Sr8RT9/3+BVG40CBG3DZhha7OavodTqTWd0E4AwJeTyegmVpe7592/Oo eypEN23eiyly3vkgEiJ/Y3bTw+ORd88WNIRm4TPMWcyahhhDMkDDGMt00fk1YqiHOOdp 6I7kVMG33gKhsobZHWz75pWqkEaC1bNBZZjzr/SZECqHjwNwGDNktQKaAxueay9/OZ1I H2v7fhiBnD/levRsU0prVixJDEOr2zr8NN/344gpJr0jhqwex+e4uiQTRFiuBlwScPVy 0DgQ== MIME-Version: 1.0 Received: by 10.52.66.70 with SMTP id d6mr22146251vdt.30.1355775474752; Mon, 17 Dec 2012 12:17:54 -0800 (PST) Sender: davide.italiano@gmail.com Received: by 10.58.229.136 with HTTP; Mon, 17 Dec 2012 12:17:54 -0800 (PST) In-Reply-To: <20121217192731.GA83405@onelab2.iet.unipi.it> References: <20121217192731.GA83405@onelab2.iet.unipi.it> Date: Mon, 17 Dec 2012 12:17:54 -0800 X-Google-Sender-Auth: 2atf83R1CkUURAQQX-9NZ0rna8M Message-ID: Subject: Re: regarding r242905 ('us' argument to some callout functions) was Re: [RFC/RFT] calloutng From: Davide Italiano To: Luigi Rizzo Content-Type: text/plain; charset=ISO-8859-1 Cc: freebsd-current , freebsd-arch@freebsd.org X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Dec 2012 20:17:56 -0000 On Mon, Dec 17, 2012 at 11:27 AM, Luigi Rizzo wrote: > [addressing the various items separately] > > On Fri, Dec 14, 2012 at 01:57:36PM +0100, Davide Italiano wrote: >> On Fri, Dec 14, 2012 at 7:41 AM, Luigi Rizzo wrote: > ... >> > - for several functions the only change is the name of an argument >> > from "busy" to "us". Can you elaborate the reason for the change, >> > and whether "us" means microseconds or the pronoun ?) >> > >> >> Please see r242905 by mav@. > > i see the goal of this patch is to pass along the amount of > time till the next timer. > > I wonder why the choice is to use (actually, call) the value > "microseconds" rather use a bintime or something scaled and with a > well defined resolution. > > In fact looking at the relevant diff > > http://svnweb.freebsd.org/base/projects/calloutng/sys/kern/kern_clocksource.c?r1=242905&r2=242904&pathrev=242905 > > cpu_idleclock() actually returns a value that is not even microseconds > but 1/(2^20) seconds. The value seems to be ignored right now > so it would be a good time to discuss the resolution. > > I am concerned that at some point (5 years from now perhaps ?) > microseconds might start to become too coarse and we would like > something with a more fine-grained resolution. On the > other hand, for the purposes of this change, we can probably > live with an upper limit of some seconds (waking up the machine > once per second is not going to kill performance). > I would talk more about power consumption problem rather than performances. Yes, you're right because now, even with calloutng changes, the CPU is woken up at least twice per second. The wheel scan, in case it doesn't find a new callout to schedule in the next half-second, schedules an interrupt half a second from "now" (where now is the time obtained using getbinuptime()/binuptime()). This is a threshold we set up empirically, and it resulted is "good" for now. But in the future someone may raise the threshold to 1 second, 10 seconds, or something like. So, I don't agree with your statement. > So i would suggest to make the argument to these functions > uint_32 or uint_64 (preferably the same for 32- and 64-bit machines), > rename it to something different from 'us' > and have at least 28-30 fractional bits to represent a bintime. > > Right now you are using a bintime with 20 fractional and 11 or 43 > bits for the integer part. > > > cheers > luigi Thanks Davide