summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sys/alpha/alpha/machdep.c3
-rw-r--r--sys/alpha/conf/GENERIC2
-rw-r--r--sys/alpha/conf/NOTES2
-rw-r--r--sys/amd64/amd64/machdep.c3
-rw-r--r--sys/amd64/conf/GENERIC2
-rw-r--r--sys/i386/conf/GENERIC2
-rw-r--r--sys/i386/conf/NEWCARD2
-rw-r--r--sys/i386/i386/machdep.c3
-rw-r--r--sys/ia64/conf/GENERIC2
-rw-r--r--sys/ia64/ia64/machdep.c3
-rw-r--r--sys/kern/subr_param.c58
-rw-r--r--sys/pc98/conf/GENERIC2
-rw-r--r--sys/pc98/i386/machdep.c3
-rw-r--r--sys/pc98/pc98/machdep.c3
-rw-r--r--sys/powerpc/aim/machdep.c3
-rw-r--r--sys/powerpc/conf/GENERIC2
-rw-r--r--sys/powerpc/powerpc/machdep.c3
-rw-r--r--sys/sparc64/conf/GENERIC2
-rw-r--r--sys/sparc64/sparc64/machdep.c7
-rw-r--r--sys/sys/systm.h3
-rw-r--r--usr.sbin/config/mkoptions.c3
21 files changed, 74 insertions, 39 deletions
diff --git a/sys/alpha/alpha/machdep.c b/sys/alpha/alpha/machdep.c
index e31b2cd..fc94dd6 100644
--- a/sys/alpha/alpha/machdep.c
+++ b/sys/alpha/alpha/machdep.c
@@ -556,7 +556,7 @@ alpha_init(pfn, ptb, bim, bip, biv)
kern_envp = bootinfo.envp;
/* Do basic tuning, hz etc */
- init_param();
+ init_param1();
/*
* Initalize the (temporary) bootstrap console interface, so
@@ -861,6 +861,7 @@ alpha_init(pfn, ptb, bim, bip, biv)
physmem -= (sz - nsz);
}
}
+ init_param2(physmem);
/*
* Initialize error message buffer (at end of core).
diff --git a/sys/alpha/conf/GENERIC b/sys/alpha/conf/GENERIC
index e55b660..efcfcaa 100644
--- a/sys/alpha/conf/GENERIC
+++ b/sys/alpha/conf/GENERIC
@@ -25,7 +25,7 @@ machine alpha
cpu EV4
cpu EV5
ident GENERIC
-maxusers 32
+maxusers 0
#To statically compile in device wiring instead of /boot/device.hints
#hints "GENERIC.hints"
diff --git a/sys/alpha/conf/NOTES b/sys/alpha/conf/NOTES
index e55b660..efcfcaa 100644
--- a/sys/alpha/conf/NOTES
+++ b/sys/alpha/conf/NOTES
@@ -25,7 +25,7 @@ machine alpha
cpu EV4
cpu EV5
ident GENERIC
-maxusers 32
+maxusers 0
#To statically compile in device wiring instead of /boot/device.hints
#hints "GENERIC.hints"
diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c
index 64a91f7..bdc0980 100644
--- a/sys/amd64/amd64/machdep.c
+++ b/sys/amd64/amd64/machdep.c
@@ -1692,7 +1692,7 @@ init386(first)
kern_envp = (caddr_t)bootinfo.bi_envp + KERNBASE;
/* Init basic tunables, hz etc */
- init_param();
+ init_param1();
/*
* make gdt memory segments, the code segment goes up to end of the
@@ -1869,6 +1869,7 @@ init386(first)
vm86_initialize();
getmemsize(first);
+ init_param2(physmem);
/* now running on new page tables, configured,and u/iom is accessible */
diff --git a/sys/amd64/conf/GENERIC b/sys/amd64/conf/GENERIC
index 03a8c96..269b210 100644
--- a/sys/amd64/conf/GENERIC
+++ b/sys/amd64/conf/GENERIC
@@ -22,7 +22,7 @@ cpu I486_CPU
cpu I586_CPU
cpu I686_CPU
ident GENERIC
-maxusers 32
+maxusers 0
#To statically compile in device wiring instead of /boot/device.hints
#hints "GENERIC.hints" #Default places to look for devices.
diff --git a/sys/i386/conf/GENERIC b/sys/i386/conf/GENERIC
index 03a8c96..269b210 100644
--- a/sys/i386/conf/GENERIC
+++ b/sys/i386/conf/GENERIC
@@ -22,7 +22,7 @@ cpu I486_CPU
cpu I586_CPU
cpu I686_CPU
ident GENERIC
-maxusers 32
+maxusers 0
#To statically compile in device wiring instead of /boot/device.hints
#hints "GENERIC.hints" #Default places to look for devices.
diff --git a/sys/i386/conf/NEWCARD b/sys/i386/conf/NEWCARD
index 440ee7f..2d4569a 100644
--- a/sys/i386/conf/NEWCARD
+++ b/sys/i386/conf/NEWCARD
@@ -26,7 +26,7 @@ cpu I486_CPU
cpu I586_CPU
cpu I686_CPU
ident NEWCARD
-maxusers 32
+maxusers 0
#To statically compile in device wiring instead of /boot/device.hints
#hints "NEWCARD.hints" #Default places to look for devices.
diff --git a/sys/i386/i386/machdep.c b/sys/i386/i386/machdep.c
index 64a91f7..bdc0980 100644
--- a/sys/i386/i386/machdep.c
+++ b/sys/i386/i386/machdep.c
@@ -1692,7 +1692,7 @@ init386(first)
kern_envp = (caddr_t)bootinfo.bi_envp + KERNBASE;
/* Init basic tunables, hz etc */
- init_param();
+ init_param1();
/*
* make gdt memory segments, the code segment goes up to end of the
@@ -1869,6 +1869,7 @@ init386(first)
vm86_initialize();
getmemsize(first);
+ init_param2(physmem);
/* now running on new page tables, configured,and u/iom is accessible */
diff --git a/sys/ia64/conf/GENERIC b/sys/ia64/conf/GENERIC
index 9638906..3d479e8 100644
--- a/sys/ia64/conf/GENERIC
+++ b/sys/ia64/conf/GENERIC
@@ -24,7 +24,7 @@
machine ia64
cpu ITANIUM
ident GENERIC
-maxusers 32
+maxusers 0
#To statically compile in device wiring instead of /boot/device.hints
#hints "GENERIC.hints"
diff --git a/sys/ia64/ia64/machdep.c b/sys/ia64/ia64/machdep.c
index 0a053d9..54660ed 100644
--- a/sys/ia64/ia64/machdep.c
+++ b/sys/ia64/ia64/machdep.c
@@ -523,7 +523,7 @@ ia64_init(u_int64_t arg1, u_int64_t arg2)
fpswa_interface = (FPSWA_INTERFACE*)IA64_PHYS_TO_RR7(bootinfo.bi_fpswa);
/* Init basic tunables, including hz */
- init_param();
+ init_param1();
p = getenv("kernelname");
if (p)
@@ -623,6 +623,7 @@ ia64_init(u_int64_t arg1, u_int64_t arg2)
phys_avail[phys_avail_cnt] = 0;
Maxmem = physmem;
+ init_param2(physmem);
/*
* Initialize error message buffer (at end of core).
diff --git a/sys/kern/subr_param.c b/sys/kern/subr_param.c
index fa37bf2..06a3dc2 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);
+}
diff --git a/sys/pc98/conf/GENERIC b/sys/pc98/conf/GENERIC
index a94f11c..278c9c8 100644
--- a/sys/pc98/conf/GENERIC
+++ b/sys/pc98/conf/GENERIC
@@ -23,7 +23,7 @@ cpu I486_CPU
cpu I586_CPU
cpu I686_CPU
ident GENERIC
-maxusers 32
+maxusers 0
#To statically compile in device wiring instead of /boot/device.hints
#hints "GENERIC.hints" #Default places to look for devices.
diff --git a/sys/pc98/i386/machdep.c b/sys/pc98/i386/machdep.c
index 4757520..6c05881 100644
--- a/sys/pc98/i386/machdep.c
+++ b/sys/pc98/i386/machdep.c
@@ -1756,7 +1756,7 @@ init386(first)
kern_envp = (caddr_t)bootinfo.bi_envp + KERNBASE;
/* Init basic tunables, hz etc */
- init_param();
+ init_param1();
/*
* make gdt memory segments, the code segment goes up to end of the
@@ -1933,6 +1933,7 @@ init386(first)
vm86_initialize();
getmemsize(first);
+ init_param2(physmem);
/* now running on new page tables, configured,and u/iom is accessible */
diff --git a/sys/pc98/pc98/machdep.c b/sys/pc98/pc98/machdep.c
index 4757520..6c05881 100644
--- a/sys/pc98/pc98/machdep.c
+++ b/sys/pc98/pc98/machdep.c
@@ -1756,7 +1756,7 @@ init386(first)
kern_envp = (caddr_t)bootinfo.bi_envp + KERNBASE;
/* Init basic tunables, hz etc */
- init_param();
+ init_param1();
/*
* make gdt memory segments, the code segment goes up to end of the
@@ -1933,6 +1933,7 @@ init386(first)
vm86_initialize();
getmemsize(first);
+ init_param2(physmem);
/* now running on new page tables, configured,and u/iom is accessible */
diff --git a/sys/powerpc/aim/machdep.c b/sys/powerpc/aim/machdep.c
index bdd6d43..b564f0e 100644
--- a/sys/powerpc/aim/machdep.c
+++ b/sys/powerpc/aim/machdep.c
@@ -436,7 +436,8 @@ powerpc_init(u_int startkernel, u_int endkernel, u_int basekernel, char *args)
__asm ("mtsprg 0, %0" :: "r"(globalp));
/* Init basic tunables, hz etc */
- init_param();
+ init_param1();
+ init_param2(physmem);
/* setup curproc so the mutexes work */
diff --git a/sys/powerpc/conf/GENERIC b/sys/powerpc/conf/GENERIC
index fde9977..d62d516 100644
--- a/sys/powerpc/conf/GENERIC
+++ b/sys/powerpc/conf/GENERIC
@@ -20,7 +20,7 @@
machine powerpc
cpu MPC750
ident GENERIC
-maxusers 32
+maxusers 0
#To statically compile in device wiring instead of /boot/device.hints
#hints "GENERIC.hints"
diff --git a/sys/powerpc/powerpc/machdep.c b/sys/powerpc/powerpc/machdep.c
index bdd6d43..b564f0e 100644
--- a/sys/powerpc/powerpc/machdep.c
+++ b/sys/powerpc/powerpc/machdep.c
@@ -436,7 +436,8 @@ powerpc_init(u_int startkernel, u_int endkernel, u_int basekernel, char *args)
__asm ("mtsprg 0, %0" :: "r"(globalp));
/* Init basic tunables, hz etc */
- init_param();
+ init_param1();
+ init_param2(physmem);
/* setup curproc so the mutexes work */
diff --git a/sys/sparc64/conf/GENERIC b/sys/sparc64/conf/GENERIC
index 9f072a4..4550883 100644
--- a/sys/sparc64/conf/GENERIC
+++ b/sys/sparc64/conf/GENERIC
@@ -24,7 +24,7 @@
machine sparc64
cpu SUN4U
ident GENERIC
-maxusers 32
+maxusers 0
#To statically compile in device wiring instead of /boot/device.hints
#hints "GENERIC.hints" #Default places to look for devices.
diff --git a/sys/sparc64/sparc64/machdep.c b/sys/sparc64/sparc64/machdep.c
index 842ce5b..88ce9a0 100644
--- a/sys/sparc64/sparc64/machdep.c
+++ b/sys/sparc64/sparc64/machdep.c
@@ -250,9 +250,14 @@ sparc64_init(caddr_t mdp, ofw_vec_t *vec)
}
/*
+ * XXX calculate physmem
+ */
+
+ /*
* Initialize tunables.
*/
- init_param();
+ init_param1();
+ init_param2(physmem);
#ifdef DDB
kdb_init();
diff --git a/sys/sys/systm.h b/sys/sys/systm.h
index 55cf1f8..3544b1f 100644
--- a/sys/sys/systm.h
+++ b/sys/sys/systm.h
@@ -121,7 +121,8 @@ void *phashinit __P((int count, struct malloc_type *type, u_long *nentries));
void cpu_boot __P((int));
void cpu_rootconf __P((void));
-void init_param __P((void));
+void init_param1 __P((void));
+void init_param2 __P((int physpages));
void tablefull __P((const char *));
int kvprintf __P((char const *, void (*)(int, void*), void *, int,
_BSD_VA_LIST_)) __printflike(1, 0);
diff --git a/usr.sbin/config/mkoptions.c b/usr.sbin/config/mkoptions.c
index db63431..77f6168 100644
--- a/usr.sbin/config/mkoptions.c
+++ b/usr.sbin/config/mkoptions.c
@@ -81,8 +81,7 @@ options(void)
}
if (maxusers == 0) {
- printf("maxusers not specified; %d assumed\n", users.u_default);
- maxusers = users.u_default;
+ /* printf("maxusers not specified; will auto-size\n"); */
} else if (maxusers < users.u_min) {
printf("minimum of %d maxusers assumed\n", users.u_min);
maxusers = users.u_min;
OpenPOWER on IntegriCloud