svn commit: r187653 - head/sys/kern
John Baldwin
jhb at FreeBSD.org
Fri Jan 23 14:08:56 PST 2009
Author: jhb
Date: Fri Jan 23 22:08:54 2009
New Revision: 187653
URL: http://svn.freebsd.org/changeset/base/187653
Log:
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
Modified:
head/sys/kern/vfs_subr.c
Modified: head/sys/kern/vfs_subr.c
==============================================================================
--- head/sys/kern/vfs_subr.c Fri Jan 23 21:08:00 2009 (r187652)
+++ head/sys/kern/vfs_subr.c Fri Jan 23 22:08:54 2009 (r187653)
@@ -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);
More information about the svn-src-head
mailing list