xref: /openbmc/linux/include/linux/threads.h (revision 5b91a75b)
1b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */
21da177e4SLinus Torvalds #ifndef _LINUX_THREADS_H
31da177e4SLinus Torvalds #define _LINUX_THREADS_H
41da177e4SLinus Torvalds 
51da177e4SLinus Torvalds 
61da177e4SLinus Torvalds /*
71da177e4SLinus Torvalds  * The default limit for the nr of threads is now in
81da177e4SLinus Torvalds  * /proc/sys/kernel/threads-max.
91da177e4SLinus Torvalds  */
101da177e4SLinus Torvalds 
111da177e4SLinus Torvalds /*
12278d1ed6SRusty Russell  * Maximum supported processors.  Setting this smaller saves quite a
13278d1ed6SRusty Russell  * bit of memory.  Use nr_cpu_ids instead of this except for static bitmaps.
141da177e4SLinus Torvalds  */
15278d1ed6SRusty Russell #ifndef CONFIG_NR_CPUS
16278d1ed6SRusty Russell /* FIXME: This should be fixed in the arch's Kconfig */
17278d1ed6SRusty Russell #define CONFIG_NR_CPUS	1
181da177e4SLinus Torvalds #endif
191da177e4SLinus Torvalds 
20278d1ed6SRusty Russell /* Places which use this should consider cpumask_var_t. */
21278d1ed6SRusty Russell #define NR_CPUS		CONFIG_NR_CPUS
22278d1ed6SRusty Russell 
231da177e4SLinus Torvalds #define MIN_THREADS_LEFT_FOR_ROOT 4
241da177e4SLinus Torvalds 
251da177e4SLinus Torvalds /*
261da177e4SLinus Torvalds  * This controls the default maximum pid allocated to a process
271da177e4SLinus Torvalds  */
281da177e4SLinus Torvalds #define PID_MAX_DEFAULT (CONFIG_BASE_SMALL ? 0x1000 : 0x8000)
291da177e4SLinus Torvalds 
301da177e4SLinus Torvalds /*
310771dfefSIngo Molnar  * A maximum of 4 million PIDs should be enough for a while.
329c40365aSJann Horn  * [NOTE: PID/TIDs are limited to 2^30 ~= 1 billion, see FUTEX_TID_MASK.]
331da177e4SLinus Torvalds  */
341da177e4SLinus Torvalds #define PID_MAX_LIMIT (CONFIG_BASE_SMALL ? PAGE_SIZE * 8 : \
351da177e4SLinus Torvalds 	(sizeof(long) > 4 ? 4 * 1024 * 1024 : PID_MAX_DEFAULT))
361da177e4SLinus Torvalds 
3772680a19SHedi Berriche /*
3872680a19SHedi Berriche  * Define a minimum number of pids per cpu.  Heuristically based
3972680a19SHedi Berriche  * on original pid max of 32k for 32 cpus.  Also, increase the
4072680a19SHedi Berriche  * minimum settable value for pid_max on the running system based
41*5b91a75bSTakahiro Itazuri  * on similar defaults.  See kernel/pid.c:pid_idr_init() for details.
4272680a19SHedi Berriche  */
4372680a19SHedi Berriche #define PIDS_PER_CPU_DEFAULT	1024
4472680a19SHedi Berriche #define PIDS_PER_CPU_MIN	8
4572680a19SHedi Berriche 
461da177e4SLinus Torvalds #endif
47