Page MenuHomeFreeBSD

D23964.diff
No OneTemporary

D23964.diff

Index: head/sys/kern/sys_pipe.c
===================================================================
--- head/sys/kern/sys_pipe.c
+++ head/sys/kern/sys_pipe.c
@@ -230,6 +230,7 @@
static int 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;
@@ -422,6 +423,20 @@
}
/*
+ * Get a timestamp.
+ *
+ * This used to be vfs_timestamp but the higher precision is unnecessary and
+ * can very negatively affect performance in virtualized environments (e.g., on
+ * vms running on amd64 when using the rdtscp instruction).
+ */
+static void
+pipe_timestamp(struct timespec *tsp)
+{
+
+ 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().
*/
@@ -804,7 +819,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;
@@ -1290,7 +1305,7 @@
error = 0;
if (error == 0)
- vfs_timestamp(&wpipe->pipe_mtime);
+ pipe_timestamp(&wpipe->pipe_mtime);
/*
* We have something to offer,

File Metadata

Mime Type
text/plain
Expires
Sat, Apr 11, 10:47 PM (13 h, 51 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
31312646
Default Alt Text
D23964.diff (1 KB)

Event Timeline