summaryrefslogtreecommitdiff
path: root/sys/kern/subr_param.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/kern/subr_param.c')
-rw-r--r--sys/kern/subr_param.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/sys/kern/subr_param.c b/sys/kern/subr_param.c
index d9eb2c7dd59b..8c2e4c6ffafb 100644
--- a/sys/kern/subr_param.c
+++ b/sys/kern/subr_param.c
@@ -149,6 +149,12 @@ init_param2(int physpages)
*/
maxproc = NPROC;
TUNABLE_INT_FETCH("kern.maxproc", &maxproc);
+ /*
+ * Limit maxproc so that kmap entries cannot be exhausted by
+ * processes.
+ */
+ if (maxproc > (physpages / 12))
+ maxproc = physpages / 12;
maxfiles = MAXFILES;
TUNABLE_INT_FETCH("kern.maxfiles", &maxfiles);
maxprocperuid = (maxproc * 9) / 10;