Skip to content

Commit f7cfcd4

Browse files
zhangyuan21xiaoxiang781216
authored andcommitted
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 <[email protected]>
1 parent 6e36a6f commit f7cfcd4

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

sched/Kconfig

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,13 @@ config SMP_NCPUS
358358
SMP configuration. However, running the SMP logic in a single CPU
359359
configuration is useful during certain testing.
360360

361+
config SMP_DEFAULT_CPUSET
362+
hex "Default CPU bit set"
363+
default 0xffffffff
364+
---help---
365+
Set the Default CPU bits. The way to use the unset CPU is to call the
366+
sched_setaffinity function to bind a task to the CPU. bit0 means CPU0.
367+
361368
endif # SMP
362369

363370
choice

sched/init/nx_start.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,8 @@ void nx_start(void)
376376
* the IDLE task.
377377
*/
378378

379-
g_idletcb[i].cmn.affinity = SCHED_ALL_CPUS;
379+
g_idletcb[i].cmn.affinity =
380+
(cpu_set_t)(CONFIG_SMP_DEFAULT_CPUSET & SCHED_ALL_CPUS);
380381
#else
381382
g_idletcb[i].cmn.flags = (TCB_FLAG_TTYPE_KERNEL |
382383
TCB_FLAG_NONCANCELABLE);

0 commit comments

Comments
 (0)