summaryrefslogtreecommitdiff
path: root/sys/kern/subr_param.c
diff options
context:
space:
mode:
authorMatthew Dillon <dillon@FreeBSD.org>2001-12-09 01:57:09 +0000
committerMatthew Dillon <dillon@FreeBSD.org>2001-12-09 01:57:09 +0000
commit66a11b9fb1208a4c4e0cdc76ace84334b70d5ab1 (patch)
tree984073874a0fe22a637b08b562d194a06c9231ee /sys/kern/subr_param.c
parentc03b8e5e6047b447d26188e822c419d251f4eb42 (diff)
Notes
Diffstat (limited to 'sys/kern/subr_param.c')
-rw-r--r--sys/kern/subr_param.c58
1 files changed, 40 insertions, 18 deletions
diff --git a/sys/kern/subr_param.c b/sys/kern/subr_param.c
index fa37bf221d69..06a3dc2dc603 100644
--- a/sys/kern/subr_param.c
+++ b/sys/kern/subr_param.c
@@ -91,31 +91,17 @@ u_quad_t sgrowsiz; /* amount to grow stack */
struct buf *swbuf;
/*
- * Boot time overrides
+ * Boot time overrides that are not scaled against main memory
*/
void
-init_param(void)
+init_param1(void)
{
- /* Base parameters */
- maxusers = MAXUSERS;
- TUNABLE_INT_FETCH("kern.maxusers", &maxusers);
hz = HZ;
TUNABLE_INT_FETCH("kern.hz", &hz);
tick = 1000000 / hz;
tickadj = howmany(30000, 60 * hz); /* can adjust 30ms in 60s */
- /* The following can be overridden after boot via sysctl */
- maxproc = NPROC;
- TUNABLE_INT_FETCH("kern.maxproc", &maxproc);
- maxfiles = MAXFILES;
- TUNABLE_INT_FETCH("kern.maxfiles", &maxfiles);
- maxprocperuid = maxproc - 1;
- maxfilesperproc = maxfiles;
-
- /* Cannot be changed after boot */
- nbuf = NBUF;
- TUNABLE_INT_FETCH("kern.nbuf", &nbuf);
#ifdef VM_SWZONE_SIZE_MAX
maxswzone = VM_SWZONE_SIZE_MAX;
#endif
@@ -124,8 +110,6 @@ init_param(void)
maxbcache = VM_BCACHE_SIZE_MAX;
#endif
TUNABLE_INT_FETCH("kern.maxbcache", &maxbcache);
- ncallout = 16 + maxproc + maxfiles;
- TUNABLE_INT_FETCH("kern.ncallout", &ncallout);
maxtsiz = MAXTSIZ;
TUNABLE_QUAD_FETCH("kern.maxtsiz", &maxtsiz);
@@ -140,3 +124,41 @@ init_param(void)
sgrowsiz = SGROWSIZ;
TUNABLE_QUAD_FETCH("kern.sgrowsiz", &sgrowsiz);
}
+
+/*
+ * Boot time overrides that are scaled against main memory
+ */
+void
+init_param2(int physpages)
+{
+
+ /* Base parameters */
+ if ((maxusers = MAXUSERS) == 0) {
+ maxusers = physpages / (1024 * 1024 / PAGE_SIZE);
+ if (maxusers < 32)
+ maxusers = 32;
+ if (maxusers > 512)
+ maxusers = 512;
+ }
+ TUNABLE_INT_FETCH("kern.maxusers", &maxusers);
+
+ /*
+ * The following can be overridden after boot via sysctl. Note:
+ * unless overriden, these macros are ultimately based on maxusers.
+ */
+ maxproc = NPROC;
+ TUNABLE_INT_FETCH("kern.maxproc", &maxproc);
+ maxfiles = MAXFILES;
+ TUNABLE_INT_FETCH("kern.maxfiles", &maxfiles);
+ maxprocperuid = maxproc - 1;
+ maxfilesperproc = maxfiles;
+
+ /*
+ * Cannot be changed after boot.
+ */
+ nbuf = NBUF;
+ TUNABLE_INT_FETCH("kern.nbuf", &nbuf);
+
+ ncallout = 16 + maxproc + maxfiles;
+ TUNABLE_INT_FETCH("kern.ncallout", &ncallout);
+}