From owner-svn-src-head@FreeBSD.ORG Wed Jul 8 19:47:03 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F00B41065674; Wed, 8 Jul 2009 19:47:03 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail08.syd.optusnet.com.au (mail08.syd.optusnet.com.au [211.29.132.189]) by mx1.freebsd.org (Postfix) with ESMTP id 8BE7A8FC16; Wed, 8 Jul 2009 19:47:03 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from c122-107-120-90.carlnfd1.nsw.optusnet.com.au (c122-107-120-90.carlnfd1.nsw.optusnet.com.au [122.107.120.90]) by mail08.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id n68Jl0CG030756 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 9 Jul 2009 05:47:01 +1000 Date: Thu, 9 Jul 2009 05:47:00 +1000 (EST) From: Bruce Evans X-X-Sender: bde@delplex.bde.org To: Mike Silbersack In-Reply-To: <200907080109.n6819CEn033840@svn.freebsd.org> Message-ID: <20090709045726.A46151@delplex.bde.org> References: <200907080109.n6819CEn033840@svn.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r195430 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 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: Wed, 08 Jul 2009 19:47:04 -0000 On Wed, 8 Jul 2009, Mike Silbersack wrote: > Log: > Increase HZ_VM from 10 to 100. While 10 hz saves cpu time > under VM environments, it's too slow for FreeBSD to work > properly. For example, ping at 10hz pings about every 600ms > instead of about every second. It shouldn't be that bad -- the error should be at most 2 ticks in the worst case, and only 1/2 a tick on average. I thought that only the worst case is normal for ping. Apparently the 2-tick error gets doubled somewhere (maybe internally in select(2) and again in ping). I use a modified ping that makes ping attempt to send a packet at every multiple of the specified interval, instead of waiting for the specified interval "between" sending each packet as documented. All sleeps and timeouts in FreeBSD except ones generated by periodic itimers give an interval that is at least as large as the specified interval (unless interrupted by a signal). ping uses select(2) timeouts, so (HZ) timer granularity necessarily gives intervals of between 0 and 1 ticks too long (average half a tick too long), and due to misimplementation details they are up to 2 ticks too long (average 1.5 ticks too long?). ping doesn't try to compensate for this and probably shouldn't, since it couldn't do better than the implementation while maintaining the minimum interval. It could use periodic itimers. My version still uses select(), but checks timestamps so as to determine how much to reduce the interval to recover from previous intervals being too long. IIRC, it does this without using extra syscalls. However, a periodic itimer could do it with fewer than the normal number of syscalls. It would restore the use of SIGALRM, and avoiding SIGALRM is an important optimization by fenner, but I think using periodic itimers would make using SIGALRM best again. I should also use a modified ping that makes ping -f actually flood. A flood ping would send packets as fast as possible. ping -f only sends them when they come back, or 100 times per second, whichever is more. 100 times per second may have been a high rate in 1980 but it isn't now, but with your HZ = 10, 100 times per second is 20 times higher than is done. With HZ = 100, 100 times per second is only 2 times higher than is done. ping -i allows setting a smaller interval than ping -f (down to ping's internal bogus granularity of 1 ms), but small intervals won't actually work unless HZ is large, due to external timer granularity. Bruce