Date: Fri, 23 Jan 2009 22:08:55 +0000 (UTC) From: John Baldwin <jhb@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r187653 - head/sys/kern Message-ID: <200901232208.n0NM8tXk055509@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200901232208.n0NM8tXk055509>