From owner-svn-src-all@FreeBSD.ORG Fri Jan 23 22:08:55 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 49E49106566B; Fri, 23 Jan 2009 22:08:55 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3998F8FC0A; Fri, 23 Jan 2009 22:08:55 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0NM8tlN055510; Fri, 23 Jan 2009 22:08:55 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0NM8tXk055509; Fri, 23 Jan 2009 22:08:55 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200901232208.n0NM8tXk055509@svn.freebsd.org> From: John Baldwin Date: Fri, 23 Jan 2009 22:08:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187653 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Jan 2009 22:08:56 -0000 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);