From owner-svn-src-head@FreeBSD.ORG Fri Aug 30 13:38:42 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 E7494151; Fri, 30 Aug 2013 13:38:42 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id 9AA162594; Fri, 30 Aug 2013 13:38:41 +0000 (UTC) Received: from porto.starpoint.kiev.ua (porto-e.starpoint.kiev.ua [212.40.38.100]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id QAA14533; Fri, 30 Aug 2013 16:38:39 +0300 (EEST) (envelope-from avg@FreeBSD.org) Received: from localhost ([127.0.0.1]) by porto.starpoint.kiev.ua with esmtp (Exim 4.34 (FreeBSD)) id 1VFOuN-0007sV-9W; Fri, 30 Aug 2013 16:38:39 +0300 Message-ID: <5220A027.8070604@FreeBSD.org> Date: Fri, 30 Aug 2013 16:37:43 +0300 From: Andriy Gapon User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:17.0) Gecko/20130810 Thunderbird/17.0.8 MIME-Version: 1.0 To: Hans Petter Selasky Subject: Re: svn commit: r255067 - head/sys/kern References: <201308301039.r7UAduI1052038@svn.freebsd.org> In-Reply-To: <201308301039.r7UAduI1052038@svn.freebsd.org> X-Enigmail-Version: 1.5.1 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit 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: Fri, 30 Aug 2013 13:38:43 -0000 on 30/08/2013 13:39 Hans Petter Selasky said the following: > Author: hselasky > Date: Fri Aug 30 10:39:56 2013 > New Revision: 255067 > URL: http://svnweb.freebsd.org/changeset/base/255067 > > Log: > Simplify pause_sbt() logic. Don't call DELAY() if remainder is less > than or equal to zero. Discussed with? Reviewed by? Tested by? Asking just because this change seems to be outside of your typical area and in the quite important infrastructural code. > Modified: > head/sys/kern/kern_synch.c > > Modified: head/sys/kern/kern_synch.c > ============================================================================== > --- head/sys/kern/kern_synch.c Fri Aug 30 10:10:22 2013 (r255066) > +++ head/sys/kern/kern_synch.c Fri Aug 30 10:39:56 2013 (r255067) > @@ -356,10 +356,7 @@ msleep_spin_sbt(void *ident, struct mtx > int > pause_sbt(const char *wmesg, sbintime_t sbt, sbintime_t pr, int flags) > { > - int sbt_sec; > - > - sbt_sec = sbintime_getsec(sbt); > - KASSERT(sbt_sec >= 0, ("pause: timo must be >= 0")); > + KASSERT(sbt >= 0, ("pause: timeout must be >= 0")); > > /* silently convert invalid timeouts */ > if (sbt == 0) > @@ -370,11 +367,14 @@ pause_sbt(const char *wmesg, sbintime_t > * We delay one second at a time to avoid overflowing the > * system specific DELAY() function(s): > */ > - while (sbt_sec > 0) { > + while (sbt >= SBT_1S) { > DELAY(1000000); > - sbt_sec--; > + sbt -= SBT_1S; > } > - DELAY((sbt & 0xffffffff) / SBT_1US); > + /* Do the delay remainder, if any */ > + sbt = (sbt + SBT_1US - 1) / SBT_1US; > + if (sbt > 0) > + DELAY(sbt); > return (0); > } > return (_sleep(&pause_wchan[curcpu], NULL, 0, wmesg, sbt, pr, flags)); > -- Andriy Gapon