kernel - Optimize vfs_msync() when MNTK_THR_SYNC is used
authorMatthew Dillon <dillon@apollo.backplane.com>
Fri, 11 Oct 2013 06:13:22 +0000 (23:13 -0700)
committerMatthew Dillon <dillon@apollo.backplane.com>
Fri, 11 Oct 2013 06:13:22 +0000 (23:13 -0700)
commiteddc656a4e9735e3069a4d449d65ff5bca9ac645
tree01cef6acc192139a0f9c2b09d9af9f6d67f876a6
parent972eaa03105f14a302bd132229a328c0e715d2bc
kernel - Optimize vfs_msync() when MNTK_THR_SYNC is used

* vfs_msync() will now use vsyncscan() when MNTK_THR_SYNC is set.
  Lazy synchronization scans will still properly ignore MADV_NOSYNC
  areas, but will not be able to optimize away the scan overhead for
  those vnodes (they remain on the syncer list).

  This change allows both lazy synchronization and explicit 'sync' commands
  to avoid having to scan all cached vnodes on the system, resulting in O(1)
  operation in many cases where it might have taken a few seconds before
  (on large systems with hundreds of thousands to millions of vnodes cached).
  With this change both the vnode sync and the memory sync will be optimal.

  Currently implemented for hammer1 and hammer2.

* Add VOBJDIRTY to the set of flags that will place the vnode on the
  syncer list.  This occurs from the vm_page_dirty() and other bits of
  code only if MNTK_THR_SYNC is set.

  Theoretically it should be safe for us to do this even though neither
  the vm_object or the related vnode are likely locked or guarded, because
  neither can go away while an associated vm_page is busied.  The syncer
  list code itself is protected with a token.
sys/kern/vfs_subr.c
sys/kern/vfs_sync.c
sys/vfs/hammer2/hammer2_chain.c
sys/vfs/hammer2/hammer2_vfsops.c
sys/vfs/hammer2/hammer2_vnops.c
sys/vm/vm_object.c