Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 19 Jun 2007 02:05:35 +1000 (EST)
From:      Bruce Evans <brde@optusnet.com.au>
To:        Xin LI <delphij@delphij.net>
Cc:        freebsd-fs@freebsd.org, jdp@freebsd.org, freebsd-current@freebsd.org
Subject:   Re: Why vfs.timestamp_precision is set to 0 by default?
Message-ID:  <20070619013303.F43847@delplex.bde.org>
In-Reply-To: <46769B76.60502@delphij.net>
References:  <46769B76.60502@delphij.net>

next in thread | previous in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20070619013303.F43847>