svn commit: r309200 - in head: lib/libc/sys sys/kern
Mark Johnston
markj at FreeBSD.org
Sat Nov 26 21:00:29 UTC 2016
Author: markj
Date: Sat Nov 26 21:00:27 2016
New Revision: 309200
URL: https://svnweb.freebsd.org/changeset/base/309200
Log:
Launder VPO_NOSYNC pages upon vnode deactivation.
As of r234483, vnode deactivation causes non-VPO_NOSYNC pages to be
laundered. This behaviour has two problems:
1. Dirty VPO_NOSYNC pages must be laundered before the vnode can be
reclaimed, and this work may be unfairly deferred to the vnlru process
or an unrelated application when the system is under vnode pressure.
2. Deactivation of a vnode with dirty VPO_NOSYNC pages requires a scan of
the corresponding VM object's memq for non-VPO_NOSYNC dirty pages; if
the laundry thread needs to launder pages from an unreferenced such
vnode, it will reactivate and deactivate the vnode with each laundering,
potentially resulting in a large number of expensive scans.
Therefore, ensure that all dirty pages are laundered upon deactivation,
i.e., when all maps of the vnode are removed and all references are
released.
Reviewed by: alc, kib
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D8641
Modified:
head/lib/libc/sys/mmap.2
head/sys/kern/vfs_subr.c
Modified: head/lib/libc/sys/mmap.2
==============================================================================
--- head/lib/libc/sys/mmap.2 Sat Nov 26 20:58:05 2016 (r309199)
+++ head/lib/libc/sys/mmap.2 Sat Nov 26 21:00:27 2016 (r309200)
@@ -28,7 +28,7 @@
.\" @(#)mmap.2 8.4 (Berkeley) 5/11/95
.\" $FreeBSD$
.\"
-.Dd February 18, 2015
+.Dd November 25, 2016
.Dt MMAP 2
.Os
.Sh NAME
@@ -189,6 +189,8 @@ this option any VM pages you dirty may b
(every 30-60 seconds usually) which can create performance problems if you
do not need that to occur (such as when you are using shared file-backed
mmap regions for IPC purposes).
+Dirty data will be flushed automatically when all mappings of an object are
+removed and all descriptors referencing the object are closed.
Note that VM/file system coherency is
maintained whether you use
.Dv MAP_NOSYNC
Modified: head/sys/kern/vfs_subr.c
==============================================================================
--- head/sys/kern/vfs_subr.c Sat Nov 26 20:58:05 2016 (r309199)
+++ head/sys/kern/vfs_subr.c Sat Nov 26 21:00:27 2016 (r309200)
@@ -3002,7 +3002,7 @@ vinactive(struct vnode *vp, struct threa
obj = vp->v_object;
if (obj != NULL && (obj->flags & OBJ_MIGHTBEDIRTY) != 0) {
VM_OBJECT_WLOCK(obj);
- vm_object_page_clean(obj, 0, 0, OBJPC_NOSYNC);
+ vm_object_page_clean(obj, 0, 0, 0);
VM_OBJECT_WUNLOCK(obj);
}
VOP_INACTIVE(vp, td);
More information about the svn-src-all
mailing list