Re: Why vfs.timestamp_precision is set to 0 by default?

From: Bruce Evans <brde_at_optusnet.com.au>
Date: Tue, 19 Jun 2007 02:05:35 +1000 (EST)
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
Received on Mon Jun 18 2007 - 14:05:51 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:12 UTC