summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordyson <dyson@FreeBSD.org>1997-08-04 07:43:28 +0000
committerdyson <dyson@FreeBSD.org>1997-08-04 07:43:28 +0000
commit4811e46aa5c4b7b170547e11f6458a10d784c737 (patch)
tree200a59fce48c16b60619e37016c339d9bd297fd2
parent14e530a9e3144da14925fa56321eff52a102d91d (diff)
downloadFreeBSD-src-4811e46aa5c4b7b170547e11f6458a10d784c737.zip
FreeBSD-src-4811e46aa5c4b7b170547e11f6458a10d784c737.tar.gz
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.)
-rw-r--r--sys/kern/vfs_export.c37
-rw-r--r--sys/kern/vfs_subr.c37
2 files changed, 42 insertions, 32 deletions
diff --git a/sys/kern/vfs_export.c b/sys/kern/vfs_export.c
index 98c85b3..3a8c88c 100644
--- a/sys/kern/vfs_export.c
+++ b/sys/kern/vfs_export.c
@@ -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--;
diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c
index 98c85b3..3a8c88c 100644
--- a/sys/kern/vfs_subr.c
+++ b/sys/kern/vfs_subr.c
@@ -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--;
OpenPOWER on IntegriCloud