Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef _LINUX_THREADS_H
0003 #define _LINUX_THREADS_H
0004 
0005 
0006 /*
0007  * The default limit for the nr of threads is now in
0008  * /proc/sys/kernel/threads-max.
0009  */
0010 
0011 /*
0012  * Maximum supported processors.  Setting this smaller saves quite a
0013  * bit of memory.  Use nr_cpu_ids instead of this except for static bitmaps.
0014  */
0015 #ifndef CONFIG_NR_CPUS
0016 /* FIXME: This should be fixed in the arch's Kconfig */
0017 #define CONFIG_NR_CPUS  1
0018 #endif
0019 
0020 /* Places which use this should consider cpumask_var_t. */
0021 #define NR_CPUS     CONFIG_NR_CPUS
0022 
0023 #define MIN_THREADS_LEFT_FOR_ROOT 4
0024 
0025 /*
0026  * This controls the default maximum pid allocated to a process
0027  */
0028 #define PID_MAX_DEFAULT (CONFIG_BASE_SMALL ? 0x1000 : 0x8000)
0029 
0030 /*
0031  * A maximum of 4 million PIDs should be enough for a while.
0032  * [NOTE: PID/TIDs are limited to 2^30 ~= 1 billion, see FUTEX_TID_MASK.]
0033  */
0034 #define PID_MAX_LIMIT (CONFIG_BASE_SMALL ? PAGE_SIZE * 8 : \
0035     (sizeof(long) > 4 ? 4 * 1024 * 1024 : PID_MAX_DEFAULT))
0036 
0037 /*
0038  * Define a minimum number of pids per cpu.  Heuristically based
0039  * on original pid max of 32k for 32 cpus.  Also, increase the
0040  * minimum settable value for pid_max on the running system based
0041  * on similar defaults.  See kernel/pid.c:pid_idr_init() for details.
0042  */
0043 #define PIDS_PER_CPU_DEFAULT    1024
0044 #define PIDS_PER_CPU_MIN    8
0045 
0046 #endif