Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 21 Sep 2015 15:03:00 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r288068 - head/sys/kern
Message-ID:  <201509211503.t8LF30dc073384@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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;
 
 	/*



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201509211503.t8LF30dc073384>