svn commit: r288068 - head/sys/kern

Konstantin Belousov kib at FreeBSD.org
Mon Sep 21 15:03:00 UTC 2015


Author: kib
Date: Mon Sep 21 15:02:59 2015
New Revision: 288068
URL: https://svnweb.freebsd.org/changeset/base/288068

Log:
  Ensure that maxproc does not exceed pid_max, at the time of boot.
  Changes to kern.pid_max mib after the boot can break this relation.
  
  The maxfiles value was calculated by the MAXFILES formula based on
  maxproc value, but this change decouples them, and MAXFILES now
  references maxusers.  Without manual tuning, the maxfiles default
  value remains as it was prior to this commit.  But for systems which
  have tuned maxproc and rely on maxfiles to adjust, additional
  reconfiguration is needed.
  
  Reported by:	rwatson
  Reviewed by:	emaste
  Sponsored by:	The FreeBSD Foundation
  MFC after:	2 weeks

Modified:
  head/sys/kern/subr_param.c

Modified: head/sys/kern/subr_param.c
==============================================================================
--- head/sys/kern/subr_param.c	Mon Sep 21 13:25:29 2015	(r288067)
+++ head/sys/kern/subr_param.c	Mon Sep 21 15:02:59 2015	(r288068)
@@ -76,7 +76,7 @@ __FBSDID("$FreeBSD$");
 #define NBUF 0
 #endif
 #ifndef MAXFILES
-#define	MAXFILES (maxproc * 2)
+#define	MAXFILES (40 + 32 * maxusers)
 #endif
 
 static int sysctl_kern_vm_guest(SYSCTL_HANDLER_ARGS);
@@ -253,6 +253,8 @@ init_param2(long physpages)
 	TUNABLE_INT_FETCH("kern.maxproc", &maxproc);
 	if (maxproc > (physpages / 12))
 		maxproc = physpages / 12;
+	if (maxproc > pid_max)
+		maxproc = pid_max;
 	maxprocperuid = (maxproc * 9) / 10;
 
 	/*


More information about the svn-src-all mailing list