summaryrefslogtreecommitdiffstats
path: root/sys/vm/vm_mmap.c
diff options
context:
space:
mode:
authorguido <guido@FreeBSD.org>2000-01-03 19:13:53 +0000
committerguido <guido@FreeBSD.org>2000-01-03 19:13:53 +0000
commitce046933ded06f3f4be7ed341d2c300e08399b6c (patch)
treeee34acf2544716e16f67976e0270b8fb2b539eea /sys/vm/vm_mmap.c
parent309101aba39c6afc2270ef84c6811a8eff789796 (diff)
downloadFreeBSD-src-ce046933ded06f3f4be7ed341d2c300e08399b6c.zip
FreeBSD-src-ce046933ded06f3f4be7ed341d2c300e08399b6c.tar.gz
Use MAP_NOSYNC for vnodes without any links in their filesystem.
This is necessary for vmware: it does not use an anonymous mmap for the memory of the virtual system. In stead it creates a temp file an unlinks it. For a 50 MB file, this results in a ot of syncing every 30 seconds. Reviewed by: Matthew Dillon <dillon@backplane.com>
Diffstat (limited to 'sys/vm/vm_mmap.c')
-rw-r--r--sys/vm/vm_mmap.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/sys/vm/vm_mmap.c b/sys/vm/vm_mmap.c
index 1721fd3..bb106f3 100644
--- a/sys/vm/vm_mmap.c
+++ b/sys/vm/vm_mmap.c
@@ -1024,6 +1024,13 @@ vm_mmap(vm_map_t map, vm_offset_t *addr, vm_size_t size, vm_prot_t prot,
return (error);
objsize = round_page(vat.va_size);
type = OBJT_VNODE;
+ /*
+ * if it is a regular file without any references
+ * we do not need to sync it.
+ */
+ if (vp->v_type == VREG && vat.va_nlink == 0) {
+ flags |= MAP_NOSYNC;
+ }
}
}
OpenPOWER on IntegriCloud