Date: Tue, 6 May 1997 13:01:45 +0100 (BST) From: Doug Rabson <dfr@nlsystems.com> To: Poul-Henning Kamp <phk@dk.tfs.com> Cc: current@freebsd.org Subject: Re: vnode->v_usage Message-ID: <Pine.BSF.3.95q.970506125821.331J-100000@herring.nlsystems.com> In-Reply-To: <207.862417862@critter>
next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, 30 Apr 1997, Poul-Henning Kamp wrote: > In message <Pine.BSF.3.95q.970427143216.346G-100000@herring.nlsystems.com>, Dou > g Rabson writes: > >On Sun, 27 Apr 1997, Poul-Henning Kamp wrote: > >> > >> Unless somebody convinces me of the utility of this field, I will remove > >> it from the vnodes. > >> > >I think it is intended to be used to keep frequently used vnodes from > >being recycled by getnewvnode. > > Well, I've done it. Here is a patch that implements LRU for name-cache > hits on the vnode freelist. I doubt that it has any performance impact, > but it makes the vnode 4 bytes smaller, which is a good thing. > > Please test and report. > > Recompile or rename your LKMs before trying this! I just had a page fault in vtouch. The code needs to check for v_freelist.tqe_prev != 0xdeadb (shudder) to protect itself from races with getnewvnode. Index: vfs_subr.c =================================================================== RCS file: /home/ncvs/src/sys/kern/vfs_subr.c,v retrieving revision 1.85 diff -u -r1.85 vfs_subr.c --- vfs_subr.c 1997/05/04 09:17:29 1.85 +++ vfs_subr.c 1997/05/06 11:57:05 @@ -2149,8 +2149,10 @@ return; } if (simple_lock_try(&vnode_free_list_slock)) { - TAILQ_REMOVE(&vnode_free_list, vp, v_freelist); - TAILQ_INSERT_TAIL(&vnode_free_list, vp, v_freelist); + if (vp->v_freelist.tqe_prev != (struct vnode **)0xdeadb) { + TAILQ_REMOVE(&vnode_free_list, vp, v_freelist); + TAILQ_INSERT_TAIL(&vnode_free_list, vp, v_freelist); + } simple_unlock(&vnode_free_list_slock); } simple_unlock(&vp->v_interlock); -- Doug Rabson Mail: dfr@nlsystems.com Nonlinear Systems Ltd. Phone: +44 181 951 1891
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.3.95q.970506125821.331J-100000>