diff options
author | jhb <jhb@FreeBSD.org> | 2009-01-23 22:08:54 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2009-01-23 22:08:54 +0000 |
commit | 4efa7c83e1eec7569c05a340284a2286efb7d56e (patch) | |
tree | a0edcee4c6e0cd5478f252588d507b98b39f89c8 /sys/kern/vfs_subr.c | |
parent | e825cd3c8423be16b445182814056a8e70d9d6fe (diff) | |
download | FreeBSD-src-4efa7c83e1eec7569c05a340284a2286efb7d56e.zip FreeBSD-src-4efa7c83e1eec7569c05a340284a2286efb7d56e.tar.gz |
Push down Giant in the vlnru kproc main loop so that it is only acquired
around calls to vlrureclaim() on non-MPSAFE filesystems. Specifically,
vnlru no longer needs Giant for the common case of waking up and deciding
there is nothing for it to do.
MFC after: 2 weeks
Diffstat (limited to 'sys/kern/vfs_subr.c')
-rw-r--r-- | sys/kern/vfs_subr.c | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index 5c6f8ff..0a08d26 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -755,14 +755,12 @@ static void vnlru_proc(void) { struct mount *mp, *nmp; - int done; + int done, vfslocked; struct proc *p = vnlruproc; EVENTHANDLER_REGISTER(shutdown_pre_sync, kproc_shutdown, p, SHUTDOWN_PRI_FIRST); - mtx_lock(&Giant); - for (;;) { kproc_suspend_check(p); mtx_lock(&vnode_free_list_mtx); @@ -779,19 +777,13 @@ vnlru_proc(void) done = 0; mtx_lock(&mountlist_mtx); for (mp = TAILQ_FIRST(&mountlist); mp != NULL; mp = nmp) { - int vfsunlocked; if (vfs_busy(mp, MBF_NOWAIT | MBF_MNTLSTLOCK)) { nmp = TAILQ_NEXT(mp, mnt_list); continue; } - if (!VFS_NEEDSGIANT(mp)) { - mtx_unlock(&Giant); - vfsunlocked = 1; - } else - vfsunlocked = 0; + vfslocked = VFS_LOCK_GIANT(mp); done += vlrureclaim(mp); - if (vfsunlocked) - mtx_lock(&Giant); + VFS_UNLOCK_GIANT(vfslocked); mtx_lock(&mountlist_mtx); nmp = TAILQ_NEXT(mp, mnt_list); vfs_unbusy(mp); |