sched: add the CPU bitset to initialize the non-exclusive CPU

Set the Default CPU bits. The way to use the unset CPU is to call the
sched_setaffinity function to bind a task to the CPU. bit0 means CPU0.

Signed-off-by: zhangyuan21 <zhangyuan21@xiaomi.com>
This commit is contained in:
zhangyuan21 2023-04-19 11:00:57 +08:00 committed by Xiang Xiao
parent 6e36a6f14c
commit f7cfcd4e95
2 changed files with 9 additions and 1 deletions

View File

@ -358,6 +358,13 @@ config SMP_NCPUS
SMP configuration. However, running the SMP logic in a single CPU SMP configuration. However, running the SMP logic in a single CPU
configuration is useful during certain testing. configuration is useful during certain testing.
config SMP_DEFAULT_CPUSET
hex "Default CPU bit set"
default 0xffffffff
---help---
Set the Default CPU bits. The way to use the unset CPU is to call the
sched_setaffinity function to bind a task to the CPU. bit0 means CPU0.
endif # SMP endif # SMP
choice choice

View File

@ -376,7 +376,8 @@ void nx_start(void)
* the IDLE task. * the IDLE task.
*/ */
g_idletcb[i].cmn.affinity = SCHED_ALL_CPUS; g_idletcb[i].cmn.affinity =
(cpu_set_t)(CONFIG_SMP_DEFAULT_CPUSET & SCHED_ALL_CPUS);
#else #else
g_idletcb[i].cmn.flags = (TCB_FLAG_TTYPE_KERNEL | g_idletcb[i].cmn.flags = (TCB_FLAG_TTYPE_KERNEL |
TCB_FLAG_NONCANCELABLE); TCB_FLAG_NONCANCELABLE);