summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBob Beck <beck@cvs.openbsd.org>2007-06-01 17:29:11 +0000
committerBob Beck <beck@cvs.openbsd.org>2007-06-01 17:29:11 +0000
commit5a025c5392a4f80fb111ca332e2194a0aa2cf605 (patch)
tree6bd181d7027ff88591a3938d1b496127b48b9214
parentcb47316cc89c30d36f1aa630684b83c31c37e3e9 (diff)
decouple the allocated number of vnodes from the "desiredvnodes" variable
which is used to size a zillion other things that increasing excessively has been shown to cause problems - so that we may incrementally look at increasing those other things without making the kernel unusable. This diff effectivly increases the number of vnodes back to the number of buffers, as in the earlier dynamic buffer cache commits, without increasing anything else (namecache, softdeps, etc. etc.) ok pedro@ tedu@ art@ thib@
-rw-r--r--sys/kern/kern_sysctl.c4
-rw-r--r--sys/kern/vfs_subr.c14
-rw-r--r--sys/sys/vnode.h5
3 files changed, 16 insertions, 7 deletions
diff --git a/sys/kern/kern_sysctl.c b/sys/kern/kern_sysctl.c
index 794d1d853c6..7e2475ddfae 100644
--- a/sys/kern/kern_sysctl.c
+++ b/sys/kern/kern_sysctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_sysctl.c,v 1.153 2007/05/29 00:17:32 thib Exp $ */
+/* $OpenBSD: kern_sysctl.c,v 1.154 2007/06/01 17:29:10 beck Exp $ */
/* $NetBSD: kern_sysctl.c,v 1.17 1996/05/20 17:49:05 mrg Exp $ */
/*-
@@ -289,7 +289,7 @@ kern_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp,
case KERN_VERSION:
return (sysctl_rdstring(oldp, oldlenp, newp, version));
case KERN_MAXVNODES:
- return(sysctl_int(oldp, oldlenp, newp, newlen, &desiredvnodes));
+ return(sysctl_int(oldp, oldlenp, newp, newlen, &maxvnodes));
case KERN_MAXPROC:
return (sysctl_int(oldp, oldlenp, newp, newlen, &maxproc));
case KERN_MAXFILES:
diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c
index dac428b9d51..a8b6aba5047 100644
--- a/sys/kern/vfs_subr.c
+++ b/sys/kern/vfs_subr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vfs_subr.c,v 1.153 2007/05/31 17:00:51 tedu Exp $ */
+/* $OpenBSD: vfs_subr.c,v 1.154 2007/06/01 17:29:10 beck Exp $ */
/* $NetBSD: vfs_subr.c,v 1.53 1996/04/22 01:39:13 christos Exp $ */
/*
@@ -105,6 +105,7 @@ void vfs_free_addrlist(struct netexport *);
void vputonfreelist(struct vnode *);
int vflush_vnode(struct vnode *, void *);
+int maxvnodes;
#ifdef DEBUG
void printlockedvnodes(void);
@@ -118,6 +119,13 @@ struct pool vnode_pool;
void
vntblinit(void)
{
+ /* buffer cache may need a vnode for each buffer */
+ /*
+ * XXX note this is different from desiredvnodes, which is
+ * XXX the old static value computed from MAXUSERS which is
+ * XXX used for sizing may other subsystems (namecache, softdeps, etc)
+ */
+ maxvnodes = bufpages;
pool_init(&vnode_pool, sizeof(struct vnode), 0, 0, 0, "vnodes",
&pool_allocator_nointr);
TAILQ_INIT(&vnode_hold_list);
@@ -356,11 +364,11 @@ getnewvnode(enum vtagtype tag, struct mount *mp, int (**vops)(void *),
* referencing buffers.
*/
toggle ^= 1;
- if (numvnodes > 2 * desiredvnodes)
+ if (numvnodes > 2 * maxvnodes)
toggle = 0;
s = splbio();
- if ((numvnodes < desiredvnodes) ||
+ if ((numvnodes < maxvnodes) ||
((TAILQ_FIRST(listhd = &vnode_free_list) == NULL) &&
((TAILQ_FIRST(listhd = &vnode_hold_list) == NULL) || toggle))) {
splx(s);
diff --git a/sys/sys/vnode.h b/sys/sys/vnode.h
index b4ad6836094..46c17791109 100644
--- a/sys/sys/vnode.h
+++ b/sys/sys/vnode.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: vnode.h,v 1.86 2007/05/31 18:22:25 thib Exp $ */
+/* $OpenBSD: vnode.h,v 1.87 2007/06/01 17:29:10 beck Exp $ */
/* $NetBSD: vnode.h,v 1.38 1996/02/29 20:59:05 cgd Exp $ */
/*
@@ -238,7 +238,8 @@ extern struct freelst vnode_free_list; /* vnode free list */
* Global vnode data.
*/
extern struct vnode *rootvnode; /* root (i.e. "/") vnode */
-extern int desiredvnodes; /* number of vnodes desired */
+extern int desiredvnodes; /* XXX number of vnodes desired */
+extern int maxvnodes; /* XXX number of vnodes to allocate */
extern time_t syncdelay; /* time to delay syncing vnodes */
extern int rushjob; /* # of slots syncer should run ASAP */
#endif /* _KERNEL */