linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [Patch 1/1] init: Provide a kernel start parameter to increase pid_max
@ 2010-04-21  1:40 Mike Travis
  2010-04-21  1:52 ` [Patch 1/1] init: Provide a kernel start parameter to increase pid_max v2 Mike Travis
  0 siblings, 1 reply; 32+ messages in thread
From: Mike Travis @ 2010-04-21  1:40 UTC (permalink / raw)
  To: Ingo Molnar, Greg Kroah-Hartman, Linus Torvalds
  Cc: Hedi Berriche, Jack Steiner, Andrew Morton, Robin Holt, LKML

Subject: [Patch 1/1] init: Provide a kernel start parameter to increase pid_max
From: Hedi Berriche <hedi@sgi.com>

On a system with a substantial number of processors, the early default pid_max
of 32k will not be enough.  A system with 1664 CPU's, there are 25163 processes
started before the login prompt.  It's estimated that with 2048 CPU's we will pass
the 32k limit.  With 4096, we'll reach that limit very early during the boot cycle,
and processes would stall waiting for an available pid.

This provides a kernel start parameter to increase the early maximum number of
pids available.  It does not change any of the defaults.

Signed-off-by: Hedi Berriche <hedi@sgi.com>
Signed-off-by: Mike Travis <travis@sgi.com>
Signed-off-by: Robin Holt <holt@sgi.com>

---
 Documentation/kernel-parameters.txt |   11 +++++++++++
 kernel/pid.c                        |   30 ++++++++++++++++++++++++++++++
 2 files changed, 41 insertions(+)

--- linux-2.6.32.orig/Documentation/kernel-parameters.txt
+++ linux-2.6.32/Documentation/kernel-parameters.txt
@@ -1327,6 +1327,17 @@ and is between 256 and 4096 characters.
 	max_luns=	[SCSI] Maximum number of LUNs to probe.
 			Should be between 1 and 2^32-1.
 
+	max_pid=nn[KMG]	[KNL] Maximum number of PID's to use.  On a system
+			with a large amount of processors, the default
+			pid_max may not be sufficient to allow the system
+			to boot.  The range of allowed values is limited from
+			pid_max_min to pid_max_max (configuration dependent.)
+			See kernel/pid.c and include/linux/threads.h for
+			specific values.  Note that specifying a value
+			too small may cause the system to fail to boot,
+			so that value is ignored.  Using a value too large,
+			and the largest allowed value will be used instead.
+
 	max_report_luns=
 			[SCSI] Maximum number of LUNs received.
 			Should be between 1 and 16384.
--- linux-2.6.32.orig/kernel/pid.c
+++ linux-2.6.32/kernel/pid.c
@@ -53,6 +53,36 @@ int pid_max_max = PID_MAX_LIMIT;
 #define BITS_PER_PAGE		(PAGE_SIZE*8)
 #define BITS_PER_PAGE_MASK	(BITS_PER_PAGE-1)
 
+static int __init set_pid_max(char *str)
+{
+	u64 maxp;
+
+	if (!str)
+		return -EINVAL;
+
+	maxp = memparse(str, &str);
+
+	if (maxp < pid_max_min) {
+		pr_warning(
+		    "pid_max smaller than minimum allowed value (%u)\n",
+			pid_max_min);
+		return -EINVAL;
+	}
+	if (maxp > pid_max_max) {
+		pr_warning(
+		    "pid_max larger than maximum allowed value, using %u\n",
+			pid_max_max);
+		pid_max = pid_max_max;
+	} else {
+		pid_max = maxp;
+		pr_info("pid_max set to %u\n", pid_max);
+	}
+
+	return 0;
+}
+
+early_param("pid_max", set_pid_max);
+
 static inline int mk_pid(struct pid_namespace *pid_ns,
 		struct pidmap *map, int off)
 {

^ permalink raw reply	[flat|nested] 32+ messages in thread

end of thread, other threads:[~2010-04-27  0:43 UTC | newest]

Thread overview: 32+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-04-21  1:40 [Patch 1/1] init: Provide a kernel start parameter to increase pid_max Mike Travis
2010-04-21  1:52 ` [Patch 1/1] init: Provide a kernel start parameter to increase pid_max v2 Mike Travis
2010-04-21  9:23   ` Alan Cox
2010-04-21 16:59     ` Hedi Berriche
2010-04-21 17:18       ` Rik van Riel
2010-04-21 17:54         ` Mike Travis
2010-04-21 19:14         ` John Stoffel
2010-04-21 19:33           ` Hedi Berriche
2010-04-21 20:10             ` John Stoffel
2010-04-21 22:24               ` Greg KH
2010-04-21 22:49                 ` Rik van Riel
2010-04-21 23:22                   ` Greg KH
2010-04-22  9:28                     ` Alan Cox
2010-04-22 12:58                       ` Jack Steiner
2010-04-22 13:57                       ` Robin Holt
2010-04-22 14:48                       ` Linus Torvalds
2010-04-22 17:08                         ` Robin Holt
2010-04-22 18:10                           ` John Stoffel
2010-04-22 20:35                           ` Andrew Morton
2010-04-25  7:16                         ` Pavel Machek
2010-04-25 17:15                           ` Linus Torvalds
2010-04-25 17:27                             ` Linus Torvalds
2010-04-25 12:13                               ` Pavel Machek
2010-04-26 19:48                             ` [Patch 1/1] init: Provide a kernel start parameter to increase pid_max v3 Mike Travis
2010-04-26 20:46                               ` Greg KH
2010-04-27  0:43                                 ` Mike Travis
2010-04-27  0:42                               ` [Patch 1/1] init: Increase pid_max based on num_possible_cpus v4 Mike Travis
2010-04-21 17:58       ` [Patch 1/1] init: Provide a kernel start parameter to increase pid_max v2 Alan Cox
2010-04-21 19:12         ` Hedi Berriche
2010-04-21 19:51           ` Greg KH
2010-04-21 20:12             ` Hedi Berriche
2010-04-21 22:05           ` Jack Steiner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).