Module Name: src Committed By: martin Date: Sat Feb 6 15:22:20 UTC 2021
Modified Files: src/sys/conf [netbsd-8]: param.c src/sys/kern [netbsd-8]: init_main.c src/sys/sys [netbsd-8]: param.h Log Message: Pull up following revision(s) (requested by simonb in ticket #1649): sys/sys/param.h: revision 1.679 sys/conf/param.c: revision 1.69 sys/kern/init_main.c: revision 1.533 (via patch) Set a better default for MAXFILES on larger RAM machines if not otherwise specified the kernel config file. Arbitary numbers are 20,000 files for 16GB RAM or more and 10,000 files for 1GB RAM or more. TODO: Adjust this and other values totally dynamically. To generate a diff of this commit: cvs rdiff -u -r1.67.10.1 -r1.67.10.2 src/sys/conf/param.c cvs rdiff -u -r1.490.6.1 -r1.490.6.2 src/sys/kern/init_main.c cvs rdiff -u -r1.542.2.10 -r1.542.2.11 src/sys/sys/param.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/conf/param.c diff -u src/sys/conf/param.c:1.67.10.1 src/sys/conf/param.c:1.67.10.2 --- src/sys/conf/param.c:1.67.10.1 Wed Apr 10 07:39:31 2019 +++ src/sys/conf/param.c Sat Feb 6 15:22:19 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: param.c,v 1.67.10.1 2019/04/10 07:39:31 martin Exp $ */ +/* $NetBSD: param.c,v 1.67.10.2 2021/02/06 15:22:19 martin Exp $ */ /* * Copyright (c) 1980, 1986, 1989 Regents of the University of California. @@ -37,7 +37,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: param.c,v 1.67.10.1 2019/04/10 07:39:31 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: param.c,v 1.67.10.2 2021/02/06 15:22:19 martin Exp $"); #ifdef _KERNEL_OPT #include "opt_hz.h" @@ -105,10 +105,6 @@ __KERNEL_RCSID(0, "$NetBSD: param.c,v 1. #define HZ 100 #endif -#ifndef MAXFILES -#define MAXFILES (3 * (NPROC + MAXUSERS) + 80) -#endif - #ifndef MAXEXEC #define MAXEXEC 16 #endif Index: src/sys/kern/init_main.c diff -u src/sys/kern/init_main.c:1.490.6.1 src/sys/kern/init_main.c:1.490.6.2 --- src/sys/kern/init_main.c:1.490.6.1 Fri Jul 13 15:49:55 2018 +++ src/sys/kern/init_main.c Sat Feb 6 15:22:19 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: init_main.c,v 1.490.6.1 2018/07/13 15:49:55 martin Exp $ */ +/* $NetBSD: init_main.c,v 1.490.6.2 2021/02/06 15:22:19 martin Exp $ */ /*- * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc. @@ -97,7 +97,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: init_main.c,v 1.490.6.1 2018/07/13 15:49:55 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: init_main.c,v 1.490.6.2 2021/02/06 15:22:19 martin Exp $"); #include "opt_ddb.h" #include "opt_inet.h" @@ -447,7 +447,23 @@ main(void) 10, VNODE_KMEM_MAXPCT) / VNODE_COST; if (usevnodes > desiredvnodes) desiredvnodes = usevnodes; -#endif +#endif /* NVNODE_IMPLICIT */ +#ifdef MAXFILES_IMPLICIT + /* + * If maximum number of files is not explicitly defined in + * kernel config, adjust the number so that it is somewhat + * more reasonable on machines with larger memory sizes. + * Arbitary numbers are 20,000 files for 16GB RAM or more + * and 10,000 files for 1GB RAM or more. + * + * XXXtodo: adjust this and other values totally dynamically + */ + if (ctob((uint64_t)physmem) >= 16ULL * 1024 * 1024 * 1024) + maxfiles = MAX(maxfiles, 20000); + if (ctob((uint64_t)physmem) >= 1024 * 1024 * 1024) + maxfiles = MAX(maxfiles, 10000); +#endif /* MAXFILES_IMPLICIT */ + vfsinit(); lf_init(); Index: src/sys/sys/param.h diff -u src/sys/sys/param.h:1.542.2.10 src/sys/sys/param.h:1.542.2.11 --- src/sys/sys/param.h:1.542.2.10 Tue Apr 14 15:50:28 2020 +++ src/sys/sys/param.h Sat Feb 6 15:22:19 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: param.h,v 1.542.2.10 2020/04/14 15:50:28 martin Exp $ */ +/* $NetBSD: param.h,v 1.542.2.11 2021/02/06 15:22:19 martin Exp $ */ /*- * Copyright (c) 1982, 1986, 1989, 1993 @@ -148,13 +148,17 @@ #include <sys/uio.h> #include <uvm/uvm_param.h> #ifndef NPROC -#define NPROC (20 + 16 * MAXUSERS) +#define NPROC (20 + 16 * MAXUSERS) +#endif +#ifndef MAXFILES +#define MAXFILES (3 * (NPROC + MAXUSERS) + 80) +#define MAXFILES_IMPLICIT #endif #ifndef NTEXT -#define NTEXT (80 + NPROC / 8) /* actually the object cache */ +#define NTEXT (80 + NPROC / 8) /* actually the object cache */ #endif #ifndef NVNODE -#define NVNODE (NPROC + NTEXT + 100) +#define NVNODE (NPROC + NTEXT + 100) #define NVNODE_IMPLICIT #endif #ifndef VNODE_KMEM_MAXPCT @@ -163,7 +167,7 @@ #ifndef BUFCACHE_VA_MAXPCT #define BUFCACHE_VA_MAXPCT 20 #endif -#define VNODE_COST 2048 /* assumed space in bytes */ +#define VNODE_COST 2048 /* assumed space in bytes */ #endif /* _KERNEL */ /* Signals. */