[Devel] [PATCH RHEL7 COMMIT] kernel/pid: restore standard PID_MAX_DEFAULT value

Konstantin Khorenko khorenko at virtuozzo.com
Tue Nov 15 08:20:39 PST 2016


The commit is pushed to "branch-rh7-3.10.0-493.vz7.25.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-493.el7
------>
commit 2ef4b6a90de7794bdfc88766497a653d8e3af229
Author: Andrey Ryabinin <aryabinin at virtuozzo.com>
Date:   Tue Nov 15 20:20:39 2016 +0400

    kernel/pid: restore standard PID_MAX_DEFAULT value
    
    Use standard value of the PID_MAX_DEFAULT. If admin needs more pids
    he could bump sysctl kernel.pid_max.
    
    On RHEL7.3 we fail to allocate struct saved_cmdlines_buffer because of
    this. saved_cmdlines_buffer contains array of PID_MAX_DEFAULT unsigned ints
    so it's too big to allocate and this causes boot failure.
    Note that there is no reason to keep that array in struct and allocate dynamically.
    Instead, we could just make it static and this will fix our problem.
    
    However, in presence of sysctl kernel.pid_max, I don't see the reason in having
    non standard PID_MAX_DEFAULT.
    
    khorenko@: previous Virtuozzo 7 kernels have kernel.pid_max hardcoded to
    1048576. Now we resurrect kernel default kernel.pid_max=32768,
    and "kernel.pid_max = 1048576" is gained via entry in /etc/sysctl.conf.
    
    https://jira.sw.ru/browse/PSBM-55365
    
    Signed-off-by: Andrey Ryabinin <aryabinin at virtuozzo.com>
---
 include/linux/threads.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/linux/threads.h b/include/linux/threads.h
index 4532014..bf62004 100644
--- a/include/linux/threads.h
+++ b/include/linux/threads.h
@@ -24,8 +24,8 @@
 /*
  * This controls the default maximum pid allocated to a process
  */
-#define PID_MAX_DEFAULT 	(sizeof(long) > 4 ? 1024 * 1024 : 32 * 1024)
-#define PID_MAX_NS_DEFAULT	(32 * 1024)
+#define PID_MAX_DEFAULT (CONFIG_BASE_SMALL ? 0x1000 : 0x8000)
+#define PID_MAX_NS_DEFAULT	(PID_MAX_DEFAULT)
 
 /*
  * A maximum of 4 million PIDs should be enough for a while.


More information about the Devel mailing list