This is an automated email from the ASF dual-hosted git repository. xiaoxiang pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit 07b27cd19903be2b0dfe1c2828de1ed4dabb3d86 Author: ligd <[email protected]> AuthorDate: Thu Mar 28 22:37:18 2024 +0800 sched: swap setting for g_npidhash in case of crash in kmm_zalloc, and crash dump use nxsched_foreach() Signed-off-by: ligd <[email protected]> --- sched/init/nx_start.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/sched/init/nx_start.c b/sched/init/nx_start.c index 10c68fd5e2..2cdf6f5a1a 100644 --- a/sched/init/nx_start.c +++ b/sched/init/nx_start.c @@ -606,15 +606,17 @@ void nx_start(void) /* Initialize the logic that determine unique process IDs. */ - g_npidhash = 1 << LOG2_CEIL(CONFIG_PID_INITIAL_COUNT); - while (g_npidhash <= CONFIG_SMP_NCPUS) + i = 1 << LOG2_CEIL(CONFIG_PID_INITIAL_COUNT); + while (i <= CONFIG_SMP_NCPUS) { - g_npidhash <<= 1; + i <<= 1; } - g_pidhash = kmm_zalloc(sizeof(*g_pidhash) * g_npidhash); + g_pidhash = kmm_zalloc(sizeof(*g_pidhash) * i); DEBUGASSERT(g_pidhash); + g_npidhash = i; + /* IDLE Group Initialization **********************************************/ idle_group_initialize();
