Further reduce the use of Giant by vm_fault(): Giant is held only when

manipulating a vnode, e.g., calling vput().  This reduces contention for
Giant during many copy-on-write faults, resulting in some additional
speedup on SMPs.

Note: debug_mpsafevm must be enabled for this optimization to take effect.
This commit is contained in:
Alan Cox 2004-08-21 19:20:21 +00:00
parent 0b6a0b955a
commit b99e61353f

View File

@ -167,9 +167,9 @@ _unlock_things(struct faultstate *fs, int dealloc)
} }
unlock_map(fs); unlock_map(fs);
if (fs->vp != NULL) { if (fs->vp != NULL) {
mtx_lock(&Giant);
vput(fs->vp); vput(fs->vp);
if (debug_mpsafevm) mtx_unlock(&Giant);
mtx_unlock(&Giant);
fs->vp = NULL; fs->vp = NULL;
} }
if (dealloc) if (dealloc)
@ -295,8 +295,7 @@ RetryFault:;
VM_OBJECT_LOCK(fs.first_object); VM_OBJECT_LOCK(fs.first_object);
vm_object_reference_locked(fs.first_object); vm_object_reference_locked(fs.first_object);
fs.vp = vnode_pager_lock(fs.first_object); fs.vp = vnode_pager_lock(fs.first_object);
if (fs.vp == NULL && debug_mpsafevm) mtx_unlock(&Giant);
mtx_unlock(&Giant);
vm_object_pip_add(fs.first_object, 1); vm_object_pip_add(fs.first_object, 1);
fs.lookup_still_valid = TRUE; fs.lookup_still_valid = TRUE;