adjust maximum number of vnodes in vnode cache according

to machine memory size upon boot if the number has not been specified
explicitly in kernel config - at this moment, 0.5% of system
memory is used for vnodes (but minimum NVNODE vnodes)
This commit is contained in:
jdolecek 2000-07-06 09:51:54 +00:00
parent 27f79f7369
commit 53385f1dfd
2 changed files with 17 additions and 2 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: init_main.c,v 1.174 2000/06/27 17:41:12 mrg Exp $ */ /* $NetBSD: init_main.c,v 1.175 2000/07/06 09:51:55 jdolecek Exp $ */
/* /*
* Copyright (c) 1995 Christopher G. Demetriou. All rights reserved. * Copyright (c) 1995 Christopher G. Demetriou. All rights reserved.
@ -188,6 +188,9 @@ main()
#if defined(NFSSERVER) || defined(NFS) #if defined(NFSSERVER) || defined(NFS)
extern void nfs_init __P((void)); extern void nfs_init __P((void));
#endif #endif
#ifdef NVNODE_IMPLICIT
int usevnodes;
#endif
/* /*
* Initialize the current process pointer (curproc) before * Initialize the current process pointer (curproc) before
@ -497,6 +500,17 @@ main()
start_init_exec = 1; start_init_exec = 1;
wakeup((void *)&start_init_exec); wakeup((void *)&start_init_exec);
#ifdef NVNODE_IMPLICIT
/*
* If maximum number of vnodes in namei vnode cache is not explicitly
* defined in kernel config, adjust the number such as we use roughly
* 0.5% of memory for vnode cache (but not less than NVNODE vnodes).
*/
usevnodes = (ptoa(physmem) / 200) / sizeof(struct vnode);
if (usevnodes > desiredvnodes)
desiredvnodes = usevnodes;
#endif
/* The scheduler is an infinite loop. */ /* The scheduler is an infinite loop. */
uvm_scheduler(); uvm_scheduler();
/* NOTREACHED */ /* NOTREACHED */

View File

@ -1,4 +1,4 @@
/* $NetBSD: param.h,v 1.101 2000/06/30 07:44:06 veego Exp $ */ /* $NetBSD: param.h,v 1.102 2000/07/06 09:51:54 jdolecek Exp $ */
/*- /*-
* Copyright (c) 1982, 1986, 1989, 1993 * Copyright (c) 1982, 1986, 1989, 1993
@ -131,6 +131,7 @@
#endif #endif
#ifndef NVNODE #ifndef NVNODE
#define NVNODE (NPROC + NTEXT + 100) #define NVNODE (NPROC + NTEXT + 100)
#define NVNODE_IMPLICIT
#endif #endif
#endif /* _KERNEL */ #endif /* _KERNEL */