From owner-freebsd-fs@FreeBSD.ORG Mon Jun 18 16:05:51 2007 Return-Path: X-Original-To: freebsd-fs@freebsd.org Delivered-To: freebsd-fs@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 42CF716A469; Mon, 18 Jun 2007 16:05:51 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail35.syd.optusnet.com.au (mail35.syd.optusnet.com.au [211.29.133.51]) by mx1.freebsd.org (Postfix) with ESMTP id BA0D713C46A; Mon, 18 Jun 2007 16:05:50 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from c220-239-235-248.carlnfd3.nsw.optusnet.com.au (c220-239-235-248.carlnfd3.nsw.optusnet.com.au [220.239.235.248]) by mail35.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id l5IG5a37017908 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 19 Jun 2007 02:05:38 +1000 Date: Tue, 19 Jun 2007 02:05:35 +1000 (EST) From: Bruce Evans X-X-Sender: bde@delplex.bde.org To: Xin LI In-Reply-To: <46769B76.60502@delphij.net> Message-ID: <20070619013303.F43847@delplex.bde.org> References: <46769B76.60502@delphij.net> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: freebsd-fs@freebsd.org, jdp@freebsd.org, freebsd-current@freebsd.org Subject: Re: Why vfs.timestamp_precision is set to 0 by default? X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Jun 2007 16:05:51 -0000 On Mon, 18 Jun 2007, Xin LI wrote: > Recently while I'm looking into the VFS code I found that we set > vfs.timestamp_precision to 0 by default. Is there any reason not to set > this to, for instance 1 by default? My rough test indicates that the > performance affect is almost negligible... o 1 second is the historical default for ffs. o vfs.timestamp_precision is global, so changing it would change the default for ffs. o 1 is a magic number. Unfortunately, TSP_HZ is not visible outside of vfs_subr.c. o The TSP_SEC and TSP_HZ settings are efficient. The other might not be, depending on the speed of hardware timecounters. o TSP_HZ gives a much larger coherence bug than TSP_SEC. The timestamp is not the current time rounded down as it should be, but is a previous time rounded down. The previous time is updated at a frequency of at most HZ (at a lower frequency iff HZ > 1000 or a certain sysctl variable is set). suppose that its update frequency is precisely HZ. The TSP_SEC gives wrong results with a probablility of about (HZ - 0.5)/HZ, while TSP_GZ gives wrong results with a probablility of about 0.5. This is hard to fix for SMP without slowing down the timestamps. I sometimes use TSP_USEC to avoid seeing this bug reported by file times coherency tests. o No userland APIs and thus no utilities support setting times with the resolution given by TSP_NSEC. Bruce