Index: sys/kern/sys_pipe.c =================================================================== --- sys/kern/sys_pipe.c +++ sys/kern/sys_pipe.c @@ -230,6 +230,7 @@ static void pipe_paircreate(struct thread *td, struct pipepair **p_pp); static __inline int pipelock(struct pipe *cpipe, int catch); static __inline void pipeunlock(struct pipe *cpipe); +static void pipe_timestamp(struct timespec *tsp); #ifndef PIPE_NODIRECT static int pipe_build_write_buffer(struct pipe *wpipe, struct uio *uio); static void pipe_destroy_write_buffer(struct pipe *wpipe); @@ -279,7 +280,7 @@ */ rpipe = &pp->pp_rpipe; bzero(rpipe, sizeof(*rpipe)); - vfs_timestamp(&rpipe->pipe_ctime); + pipe_timestamp(&rpipe->pipe_ctime); rpipe->pipe_atime = rpipe->pipe_mtime = rpipe->pipe_ctime; wpipe = &pp->pp_wpipe; @@ -389,6 +390,18 @@ } } +static void +pipe_timestamp(struct timespec *tsp) +{ + + /* + * This used to be vfs_timestamp but the higher precision is unnecessarily + * and can very negatively affect performance in virtualized environments + * (e.g., on vms running on amd64 when using the rdtscp instruction). + */ + getnanotime(tsp); +} + /* * The pipe system call for the DTYPE_PIPE type of pipes. If we fail, let * the zone pick up the pieces via pipeclose(). @@ -779,7 +792,7 @@ /* XXX: should probably do this before getting any locks. */ if (error == 0) - vfs_timestamp(&rpipe->pipe_atime); + pipe_timestamp(&rpipe->pipe_atime); unlocked_error: --rpipe->pipe_busy; @@ -1271,7 +1284,7 @@ error = 0; if (error == 0) - vfs_timestamp(&wpipe->pipe_mtime); + pipe_timestamp(&wpipe->pipe_mtime); /* * We have something to offer,