Fix a problem with the vfs vnode caching that it doesn't grow quickly

enough and can cause some strange performance problems.  Specifically, at
or near startup time is when the problem is worst.  To reproduce
the problem, run "lat_syscall stat" from the alpha lmbench code right
after bootup.  A positive side effect of this mod is that the name
cache can be set to grow again by sysctl.  A noticable positive
performance impact is realized due to a larger namecache being available
as needed (or tuned.)
This commit is contained in:
dyson 1997-08-04 07:43:28 +00:00
parent 14e530a9e3
commit 4811e46aa5
2 changed files with 42 additions and 32 deletions

View File

@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)vfs_subr.c 8.31 (Berkeley) 5/26/95
* $Id: vfs_subr.c,v 1.88 1997/06/22 03:00:21 dyson Exp $
* $Id: vfs_subr.c,v 1.89 1997/07/17 07:17:31 dfr Exp $
*/
/*
@ -354,24 +354,29 @@ getnewvnode(tag, mp, vops, vpp)
simple_lock(&vnode_free_list_slock);
TAILQ_FOREACH(vp, &vnode_free_list, v_freelist) {
if (!simple_lock_try(&vp->v_interlock))
continue;
if (vp->v_usecount)
panic("free vnode isn't");
if (freevnodes >= desiredvnodes) {
TAILQ_FOREACH(vp, &vnode_free_list, v_freelist) {
if (!simple_lock_try(&vp->v_interlock))
continue;
if (vp->v_usecount)
panic("free vnode isn't");
if (vp->v_object && vp->v_object->resident_page_count) {
/* Don't recycle if it's caching some pages */
simple_unlock(&vp->v_interlock);
continue;
} else if (LIST_FIRST(&vp->v_cache_src)) {
/* Don't recycle if active in the namecache */
simple_unlock(&vp->v_interlock);
continue;
} else {
break;
if (vp->v_object && vp->v_object->resident_page_count) {
/* Don't recycle if it's caching some pages */
simple_unlock(&vp->v_interlock);
continue;
} else if (LIST_FIRST(&vp->v_cache_src)) {
/* Don't recycle if active in the namecache */
simple_unlock(&vp->v_interlock);
continue;
} else {
break;
}
}
} else {
vp = NULL;
}
if (vp) {
TAILQ_REMOVE(&vnode_free_list, vp, v_freelist);
freevnodes--;

View File

@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)vfs_subr.c 8.31 (Berkeley) 5/26/95
* $Id: vfs_subr.c,v 1.88 1997/06/22 03:00:21 dyson Exp $
* $Id: vfs_subr.c,v 1.89 1997/07/17 07:17:31 dfr Exp $
*/
/*
@ -354,24 +354,29 @@ getnewvnode(tag, mp, vops, vpp)
simple_lock(&vnode_free_list_slock);
TAILQ_FOREACH(vp, &vnode_free_list, v_freelist) {
if (!simple_lock_try(&vp->v_interlock))
continue;
if (vp->v_usecount)
panic("free vnode isn't");
if (freevnodes >= desiredvnodes) {
TAILQ_FOREACH(vp, &vnode_free_list, v_freelist) {
if (!simple_lock_try(&vp->v_interlock))
continue;
if (vp->v_usecount)
panic("free vnode isn't");
if (vp->v_object && vp->v_object->resident_page_count) {
/* Don't recycle if it's caching some pages */
simple_unlock(&vp->v_interlock);
continue;
} else if (LIST_FIRST(&vp->v_cache_src)) {
/* Don't recycle if active in the namecache */
simple_unlock(&vp->v_interlock);
continue;
} else {
break;
if (vp->v_object && vp->v_object->resident_page_count) {
/* Don't recycle if it's caching some pages */
simple_unlock(&vp->v_interlock);
continue;
} else if (LIST_FIRST(&vp->v_cache_src)) {
/* Don't recycle if active in the namecache */
simple_unlock(&vp->v_interlock);
continue;
} else {
break;
}
}
} else {
vp = NULL;
}
if (vp) {
TAILQ_REMOVE(&vnode_free_list, vp, v_freelist);
freevnodes--;