From owner-svn-src-head@FreeBSD.ORG Tue Sep 10 12:03:06 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 4497D704; Tue, 10 Sep 2013 12:03:06 +0000 (UTC) (envelope-from davide.italiano@gmail.com) Received: from mail-vb0-x232.google.com (mail-vb0-x232.google.com [IPv6:2607:f8b0:400c:c02::232]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id BFEA12383; Tue, 10 Sep 2013 12:03:05 +0000 (UTC) Received: by mail-vb0-f50.google.com with SMTP id x14so5104428vbb.9 for ; Tue, 10 Sep 2013 05:03:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=ThEVo0Z9g7CGDdoOrWPDiARWWS/ugxsS1fNPp9oYraI=; b=DCe2uLYGR0oQIJjtoRjBqPw/WTE54KMQrcLFHraXWFniBfKB5kokx0mEnkpa/4El9T JnuXYAxZtJ6Ck4fFyoIl/FtUHikURAP0L1f6lEsPmMp5YvU12/c/H32edD9CVRP7Jqd6 Q4vh7LK6Giqt5BmSAiqnBTOwVQ9ZJ+TqO/uQnmWwpwxtjaPN0MYWQE9sREtOe47pK2uH QcHviBedhpKEdHMc8HKwajs/jBAm6u/IrKhv1TcX/E6bBq02CwgqouhwtyKPozcS2H0g EUzMSvja2ePDRkKU9FMfqGuva8BCgHwF2oyN23B/ZONaxqrgIK97bSW9658R8303TARl YtHQ== MIME-Version: 1.0 X-Received: by 10.52.120.78 with SMTP id la14mr19427822vdb.9.1378814584826; Tue, 10 Sep 2013 05:03:04 -0700 (PDT) Sender: davide.italiano@gmail.com Received: by 10.220.65.132 with HTTP; Tue, 10 Sep 2013 05:03:04 -0700 (PDT) In-Reply-To: <201309100146.r8A1kmri091170@svn.freebsd.org> References: <201309100146.r8A1kmri091170@svn.freebsd.org> Date: Tue, 10 Sep 2013 14:03:04 +0200 X-Google-Sender-Auth: QBk7a9ZBA9yTbu-lxr5EIzmpEeg Message-ID: Subject: Re: svn commit: r255437 - in head: cddl/contrib/opensolaris/lib/libzpool/common cddl/contrib/opensolaris/lib/libzpool/common/sys sys/cddl/compat/opensolaris/sys sys/cddl/contrib/opensolaris/uts/common/... From: Davide Italiano To: Xin LI Content-Type: text/plain; charset=ISO-8859-1 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Sep 2013 12:03:06 -0000 On Tue, Sep 10, 2013 at 3:46 AM, Xin LI wrote: [snip] > +static clock_t > +cv_timedwait_hires(kcondvar_t *cvp, kmutex_t *mp, hrtime_t tim, hrtime_t res, > + int flag) > +{ > + sbintime_t sbt; > + sbintime_t pr; > + > + sbt = tim * SBT_1NS; > + pr = res * SBT_1NS; > + > + return (cv_timedwait_sbt(cvp, mp, sbt, pr, 0)); > +} > + > #endif /* _KERNEL */ > The Illumos cv_timedwait_hires() doesn't use 'res' argument so if you want to be consistent with their behaviour you should pass '0' as precision argument to cv_timedwait_sbt(). Also, I'm not sure there's an 1:1 mapping between ours 'pr' and their 'res'. Even if there is, considering you're dealing with nanoseconds I don't think you will see great advantage from specifying precision argument in most of the cases (hardware clock resolution is in the common case 10^-6). > @@ -1473,7 +1473,7 @@ dsl_scan_sync(dsl_pool_t *dp, dmu_tx_t * > "free_bpobj/bptree txg %llu", > (longlong_t)scn->scn_visited_this_txg, > (longlong_t) > - (gethrtime() - scn->scn_sync_start_time) / MICROSEC, > + NSEC2MSEC(gethrtime() - scn->scn_sync_start_time), > (longlong_t)tx->tx_txg); > scn->scn_visited_this_txg = 0; > /* The usage of gethrtime() as-it-is in FreeBSD goes against your precision requirements. In fact, it's implemented as a wrapper to getnanouptime(), which could be defined as "fast but not precise" as it read a cached value which is upadted from time to time rather than going into the underlying hardware to get the information required. More precisely speaking, in case hz=1000, you might be 1 millisecond away from the value you're looking for. -- Davide "There are no solved problems; there are only problems that are more or less solved" -- Henri Poincare