diff --git a/sched/Kconfig b/sched/Kconfig index 232c009f8c..635cbbb9ba 100644 --- a/sched/Kconfig +++ b/sched/Kconfig @@ -1939,3 +1939,12 @@ config GROUP_KILL_CHILDREN_TIMEOUT_MS > 0 means wait timeout = 0 means don't do kill signal +config PID_INITIAL_COUNT + int "Initial length of pid table" + default 8 if DEFAULT_SMALL + default 16 if !DEFAULT_SMALL + ---help--- + This is the initial length of pid table, which the system + can still expand when needed. It is rounded up to power of + two by current implementation. If the number of threads in + your system is known at design time, setting this to it. diff --git a/sched/init/nx_start.c b/sched/init/nx_start.c index 1252ff9e6e..852ac5ab72 100644 --- a/sched/init/nx_start.c +++ b/sched/init/nx_start.c @@ -45,6 +45,7 @@ #include #include #include +#include #include "task/task.h" #include "sched/sched.h" @@ -623,7 +624,7 @@ void nx_start(void) /* Initialize the logic that determine unique process IDs. */ - g_npidhash = 4; + g_npidhash = 1 << LOG2_CEIL(CONFIG_PID_INITIAL_COUNT); while (g_npidhash <= CONFIG_SMP_NCPUS) { g_npidhash <<= 1;