path: root/kernel/pid.c
diff options
authorHedi Berriche <>2010-05-26 14:44:06 -0700
committerLinus Torvalds <>2010-05-27 09:12:51 -0700
commit72680a191b934377430032f93af15ef50aafb3a8 (patch)
treee6f41babe66bf642204b3d92e793f5071739b1d2 /kernel/pid.c
parentbd4fb654e3a0d83ca8cb138c5e3e6e65407e119c (diff)
pids: increase pid_max based on num_possible_cpus
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 patch increases the early maximum number of pids available, and increases the minimum number of pids that can be set during runtime. [ fix warnings] Signed-off-by: Hedi Berriche <> Signed-off-by: Mike Travis <> Signed-off-by: Robin Holt <> Acked-by: Linus Torvalds <> Cc: Ingo Molnar <> Cc: Pavel Machek <> Cc: Alan Cox <> Cc: Greg KH <> Cc: Rik van Riel <> Cc: John Stoffel <> Cc: Jack Steiner <> Signed-off-by: Andrew Morton <> Signed-off-by: Linus Torvalds <>
Diffstat (limited to 'kernel/pid.c')
1 files changed, 7 insertions, 0 deletions
diff --git a/kernel/pid.c b/kernel/pid.c
index aebb30d9c233..e9fd8c132d26 100644
--- a/kernel/pid.c
+++ b/kernel/pid.c
@@ -513,6 +513,13 @@ void __init pidhash_init(void)
void __init pidmap_init(void)
+ /* bump default and minimum pid_max based on number of cpus */
+ pid_max = min(pid_max_max, max_t(int, pid_max,
+ PIDS_PER_CPU_DEFAULT * num_possible_cpus()));
+ pid_max_min = max_t(int, pid_max_min,
+ PIDS_PER_CPU_MIN * num_possible_cpus());
+ pr_info("pid_max: default: %u minimum: %u\n", pid_max, pid_max_min);
init_pid_ns.pidmap[0].page = kzalloc(PAGE_SIZE, GFP_KERNEL);
/* Reserve PID 0. We never call free_pidmap(0) */
set_bit(0, init_pid_ns.pidmap[0].page);