Date: Tue, 16 Oct 2001 19:16:49 -0700 (PDT) From: John Baldwin <jhb@FreeBSD.org> To: Dag-Erling Smorgrav <des@ofug.org> Cc: dillon@freebsd.org, hackers@freebsd.org Subject: RE: Some questions regarding vfs / ffs Message-ID: <XFMail.011016191649.jhb@FreeBSD.org> In-Reply-To: <xzpsncjvzmq.fsf@flood.ping.uio.no>
next in thread | previous in thread | raw e-mail | index | archive | help
On 17-Oct-01 Dag-Erling Smorgrav wrote: > Why do we have a single mntvnode_mtx instead of one per struct mount? > It's supposed to protect the (per-mount) vnode list, so logically it > should be a per-mount mutex. The only reason I can find for it being > global is that it saves a few keystrokes in insmntque(). This is the > only place I've found where mntvnode_mtx is held and more than one > mount is invloved. Umm, I dunno. > Why does ffs_sync() grab the vnode interlock before checking if the > vnode is dirty? As far as I can determine (from comments in the > headers), none of the information it examines is protected by the > interlock. Are the comments wrong, or is the code wrong? If the code > is wrong, then this is what is killing interrupt latency on my box: > needlessly acquiring and releasing 40,000 or 60,000 vnode interlocks > twice per minute. > > Also, ffs_sync() does a lot of locking and unlocking of mntvnode_mtx, > when actually (I think) it could get away with just unlocking it > briefly while actually syncing a vnode, and holding it the rest of the > time. I believe the reason why it currently does what it does is to > avoid a lock reversal between mntvnode_mtx and the vnode locks. This > won't be a problem if I'm right about the vnode lock being held > unnecessarily. Not quite. You see, when we set the mount vnode pointer inside the vnode, we get the mntvnode mutex while holding the vnode interlock, so the order is thus vnode -> mntvnode. So, the ffs_sync() loop can't lock the vnode while holding the mntvnode lock. It actually used to do that. -- John Baldwin <jhb@FreeBSD.org> -- http://www.FreeBSD.org/~jhb/ PGP Key: http://www.baldwin.cx/~john/pgpkey.asc "Power Users Use the Power to Serve!" - http://www.FreeBSD.org/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?XFMail.011016191649.jhb>